lzip: New completion.

master
Ville Skyttä 2011-12-10 18:27:21 +02:00
parent 17c9722733
commit f09ced610d
4 changed files with 66 additions and 0 deletions

View File

@ -170,6 +170,7 @@ bashcomp_DATA = a2x \
lrzip \
lsof \
lvm \
lzip \
lzma \
lzop \
macof \

44
completions/lzip Normal file
View File

@ -0,0 +1,44 @@
# lzip(1) completion -*- shell-script -*-
_lzip()
{
local cur prev words cword split
_init_completion -s || return
local decompress=false
case $prev in
-h|--help|-V|--version|-b|--member-size|-m|--match-length|\
-s|--dictionary-size|-S|--volume-size)
return
;;
-d|--decompress)
decompress=true
;;
-o|--output)
_filedir
return
;;
esac
$split && return
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) {-1..-9}' \
-- "$cur" ) )
return
fi
if $decompress; then
_filedir lz
return
fi
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $( compgen -f -X "*.lz" -- "$cur" ) \
$( compgen -d -- "$cur" ) )
} &&
complete -F _lzip lzip
# ex: ts=4 sw=4 et filetype=sh

1
test/completion/lzip.exp Normal file
View File

@ -0,0 +1 @@
assert_source_completions lzip

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}
proc teardown {} {
assert_env_unmodified
}
setup
assert_complete_any "lzip "
sync_after_int
teardown