Add lr(un)zip completion.
This commit is contained in:
parent
8346a428fc
commit
48027cfbe1
2
CHANGES
2
CHANGES
@ -5,7 +5,7 @@ bash-completion (2.x)
|
||||
|
||||
[ Ville Skyttä ]
|
||||
* Activate hping2 completion also for hping and hping3.
|
||||
* Add crontab completion.
|
||||
* Add crontab and lrzip completions.
|
||||
* Add gif to mplayer filename completions (Alioth: #312512).
|
||||
* Add "short" tarball extensions to unxz, unlzma etc completions.
|
||||
|
||||
|
@ -75,6 +75,7 @@ bashcomp_DATA = contrib/abook \
|
||||
contrib/links \
|
||||
contrib/lintian \
|
||||
contrib/lisp \
|
||||
contrib/lrzip \
|
||||
contrib/lvm \
|
||||
contrib/lzma \
|
||||
contrib/lzop \
|
||||
|
@ -78,6 +78,7 @@ complete -f -X '!*.Z' uncompress
|
||||
# lzcmp, lzdiff intentionally not here, see Debian: #455510
|
||||
complete -f -X '!*.@(tlz|lzma)' lzcat lzegrep lzfgrep lzgrep lzless lzmore unlzma
|
||||
complete -f -X '!*.@(?(t)xz|tlz|lzma)' unxz xzcat
|
||||
complete -f -X '!*.lrz' lrunzip
|
||||
complete -f -X '!*.@(gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX)' ee
|
||||
complete -f -X '!*.@(gif|jp?(e)g|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|GIF|JPG|JP?(E)G|TIF?(F)|PNG|P[BGP]M|BMP|X[BP]M|RLE|RGB|PCX|FITS|PM)' xv qiv
|
||||
complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))' gv ggv kghostview
|
||||
|
63
contrib/lrzip
Normal file
63
contrib/lrzip
Normal file
@ -0,0 +1,63 @@
|
||||
# lrzip(1) completion
|
||||
|
||||
have lrzip &&
|
||||
_lrzip()
|
||||
{
|
||||
COMPREPLY=()
|
||||
local cur prev
|
||||
_get_comp_words_by_ref cur prev
|
||||
|
||||
if [[ "$cur" == -* && $prev != -N ]]; then
|
||||
COMPREPLY=( $( compgen -W '-w -d -o -O -S -f -D -q -L -n -l -b -g -M \
|
||||
-T -N -v -vv -V -h' -- "$cur" ) )
|
||||
return 0
|
||||
fi
|
||||
|
||||
local xspec="*.lrz"
|
||||
|
||||
case $prev in
|
||||
-w|-S|-V|-h)
|
||||
return 0
|
||||
;;
|
||||
-d)
|
||||
xspec="!"$xspec
|
||||
;;
|
||||
-o)
|
||||
_filedir
|
||||
return 0
|
||||
;;
|
||||
-O)
|
||||
_filedir -d
|
||||
return 0
|
||||
;;
|
||||
-L)
|
||||
COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
-T)
|
||||
COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9 10' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
-N)
|
||||
COMPREPLY=( $( compgen -W '-20 -19 -18 -17 -16 -15 -14 -13 -12 \
|
||||
-11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 \
|
||||
12 13 14 15 16 17 18 19' -- "$cur" ) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
_expand || return 0
|
||||
|
||||
local IFS=$'\t\n'
|
||||
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
|
||||
$( compgen -d -- "$cur" ) )
|
||||
} &&
|
||||
complete -F _lrzip -o filenames lrzip
|
||||
|
||||
# Local variables:
|
||||
# mode: shell-script
|
||||
# sh-basic-offset: 4
|
||||
# sh-indent-comment: t
|
||||
# indent-tabs-mode: nil
|
||||
# End:
|
||||
# ex: ts=4 sw=4 et filetype=sh
|
1
test/completion/lrzip.exp
Normal file
1
test/completion/lrzip.exp
Normal file
@ -0,0 +1 @@
|
||||
assert_source_completions lrzip
|
20
test/lib/completions/lrzip.exp
Normal file
20
test/lib/completions/lrzip.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "lrzip "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
Loading…
x
Reference in New Issue
Block a user