[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.90-85-gf09ced6
Ville Skyttä
ville.skytta at iki.fi
Sat Dec 10 16:27:29 UTC 2011
The following commit has been merged in the master branch:
commit f09ced610d6f9c9ea694d2eade7bdcf75e535afc
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Sat Dec 10 18:27:21 2011 +0200
lzip: New completion.
diff --git a/completions/Makefile.am b/completions/Makefile.am
index 5b2e68f..4570c21 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -170,6 +170,7 @@ bashcomp_DATA = a2x \
lrzip \
lsof \
lvm \
+ lzip \
lzma \
lzop \
macof \
diff --git a/completions/lzip b/completions/lzip
new file mode 100644
index 0000000..9df5538
--- /dev/null
+++ b/completions/lzip
@@ -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
diff --git a/test/completion/lzip.exp b/test/completion/lzip.exp
new file mode 100644
index 0000000..faa83a4
--- /dev/null
+++ b/test/completion/lzip.exp
@@ -0,0 +1 @@
+assert_source_completions lzip
diff --git a/test/lib/completions/bc.exp b/test/lib/completions/lzip.exp
similarity index 80%
copy from test/lib/completions/bc.exp
copy to test/lib/completions/lzip.exp
index 23c22b6..fd92af6 100644
--- a/test/lib/completions/bc.exp
+++ b/test/lib/completions/lzip.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "bc --"
+assert_complete_any "lzip "
sync_after_int
--
bash-completion
More information about the Bash-completion-commits
mailing list