Skip to content

Commit 29c8644

Browse files
authored
7z, tar, unace, unrar, unzip, zipinfo: recognize comic book archives (#488)
Comic book archives¹ are simply archive files containing images. While they are typically treated as e-books and fed to programs that can handle those, they are also plain archive files and can therefore be manipulated by the corresponding program. ¹ https://en.wikipedia.org/wiki/Comic_book_archive The following file extension mappings are added: .cb7 → 7z .cba → unace .cbr → unrar .cbt → tar .cbz → unzip, zipinfo (Note that .cbt files, unlike .tar files, are never compressed.)
1 parent ece6b7b commit 29c8644

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

bash_completion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2188,7 +2188,7 @@ _install_xspec()
21882188
}
21892189
# bzcmp, bzdiff, bz*grep, bzless, bzmore intentionally not here, see Debian: #455510
21902190
_install_xspec '!*.?(t)bz?(2)' bunzip2 bzcat pbunzip2 pbzcat lbunzip2 lbzcat
2191-
_install_xspec '!*.@(zip|[aegjswx]ar|exe|pk3|wsz|zargo|xpi|s[tx][cdiw]|sx[gm]|o[dt][tspgfc]|od[bm]|oxt|?(o)xps|epub|apk|aab|ipa|do[ct][xm]|p[op]t[mx]|xl[st][xm]|pyz|whl)' unzip zipinfo
2191+
_install_xspec '!*.@(zip|[aegjswx]ar|exe|pk3|wsz|zargo|xpi|s[tx][cdiw]|sx[gm]|o[dt][tspgfc]|od[bm]|oxt|?(o)xps|epub|cbz|apk|aab|ipa|do[ct][xm]|p[op]t[mx]|xl[st][xm]|pyz|whl)' unzip zipinfo
21922192
_install_xspec '*.Z' compress znew
21932193
# zcmp, zdiff, z*grep, zless, zmore intentionally not here, see Debian: #455510
21942194
_install_xspec '!*.@(Z|[gGd]z|t[ag]z)' gunzip zcat

completions/7z

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ _7z()
110110
# (assumption: extensions are all lowercase)
111111
[[ $mode == w ]] &&
112112
_filedir '@(7z|bz2|swf|?(g)tar|?(t)[bglx]z|tb?(z)2|wim)' ||
113-
_filedir '@(7z|arj|bz2|cab|chm|cpio|deb|dmg|flv|gem|img|iso|lz[ah]|lzma?(86)|msi|pmd|[rx]ar|rpm|sw[fm]|?(g)tar|taz|?(t)[bglx]z|tb?(z)2|vhd|wim|Z)'
113+
_filedir '@(7z|arj|bz2|cab|cb7|chm|cpio|deb|dmg|flv|gem|img|iso|lz[ah]|lzma?(86)|msi|pmd|[rx]ar|rpm|sw[fm]|?(g)tar|taz|?(t)[bglx]z|tb?(z)2|vhd|wim|Z)'
114114
else
115115
if [[ ${words[1]} == d ]]; then
116116
local IFS=$'\n'

completions/tar

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ __tar_cleanup_prev()
422422

423423
__tar_detect_ext()
424424
{
425-
local tars='@(@(tar|gem|spkg)?(.@(Z|[bgx]z|bz2|lz?(ma|o)|zst))|t@([abglx]z|b?(z)2|zst))'
425+
local tars='@(@(tar|gem|spkg)?(.@(Z|[bgx]z|bz2|lz?(ma|o)|zst))|t@([abglx]z|b?(z)2|zst)|cbt)'
426426
if [[ ${COMP_WORDS[0]} == ?(*/)bsdtar ]]; then
427427
# https://github.com/libarchive/libarchive/wiki/LibarchiveFormats
428428
tars=${tars/%\)/|pax|cpio|iso|zip|@(j|x)ar|mtree|a|7z|warc}
@@ -441,7 +441,7 @@ __tar_detect_ext()
441441
# Should never happen?
442442
;;
443443
?(-)*[cr]*f)
444-
ext='@(tar|gem|spkg)'
444+
ext='@(tar|gem|spkg|cbt)'
445445
case ${words[1]} in
446446
*a*) ext="$tars" ;;
447447
*z*) ext='t?(ar.)gz' ;;

completions/unace

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ _unace()
1111
if ((cword == 1)); then
1212
COMPREPLY=($(compgen -W 'e l t v x' -- "$cur"))
1313
else
14-
_filedir ace
14+
_filedir '@(ace|cba)'
1515
fi
1616
fi
1717
} &&

completions/unrar

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ _unrar()
1313
if ((cword == 1)); then
1414
COMPREPLY=($(compgen -W 'e l lb lt p t v vb vt x' -- "$cur"))
1515
else
16-
_filedir '@(rar|exe)'
16+
_filedir '@(rar|exe|cbr)'
1717
fi
1818
fi
1919

0 commit comments

Comments
 (0)