summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2011-12-10 18:27:21 +0200
committerVille Skyttä <ville.skytta@iki.fi>2011-12-10 18:27:21 +0200
commitf09ced610d6f9c9ea694d2eade7bdcf75e535afc (patch)
tree6bb4ef1e0db05ce055afa078d473af36ae8bf539
parent17c9722733a3e50f7b5113ca99fba9424b078274 (diff)
downloadbash-completion-f09ced610d6f9c9ea694d2eade7bdcf75e535afc.tar.gz
lzip: New completion.
-rw-r--r--completions/Makefile.am1
-rw-r--r--completions/lzip44
-rw-r--r--test/completion/lzip.exp1
-rw-r--r--test/lib/completions/lzip.exp20
4 files changed, 66 insertions, 0 deletions
diff --git a/completions/Makefile.am b/completions/Makefile.am
index 5b2e68ff..4570c217 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 00000000..9df55382
--- /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 00000000..faa83a41
--- /dev/null
+++ b/test/completion/lzip.exp
@@ -0,0 +1 @@
+assert_source_completions lzip
diff --git a/test/lib/completions/lzip.exp b/test/lib/completions/lzip.exp
new file mode 100644
index 00000000..fd92af62
--- /dev/null
+++ b/test/lib/completions/lzip.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "lzip "
+
+
+sync_after_int
+
+
+teardown