summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Murzov <e-mail@date.by>2012-03-18 03:04:58 +0400
committerIgor Murzov <e-mail@date.by>2012-03-18 03:04:58 +0400
commit52e14b2ec251ed11ceac6ca362c1fc7bbbd47f30 (patch)
tree2f2eb499e6503e6f3e366a3b778b1f4da8d6fe59
parent644020ab575f4d4cffa043282c54689c0f882a4c (diff)
downloadbash-completion-52e14b2ec251ed11ceac6ca362c1fc7bbbd47f30.tar.gz
cpack: New completion.
-rw-r--r--completions/Makefile.am1
-rw-r--r--completions/cpack61
-rw-r--r--test/completion/cpack.exp1
-rw-r--r--test/lib/completions/cpack.exp18
4 files changed, 81 insertions, 0 deletions
diff --git a/completions/Makefile.am b/completions/Makefile.am
index 4173b1dc..5f830166 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -52,6 +52,7 @@ bashcomp_DATA = a2x \
configure \
convert \
cowsay \
+ cpack \
cpan2dist \
cpio \
cppcheck \
diff --git a/completions/cpack b/completions/cpack
new file mode 100644
index 00000000..84dcfd53
--- /dev/null
+++ b/completions/cpack
@@ -0,0 +1,61 @@
+# bash completion for cpack(1) -*- shell-script -*-
+
+_cpack()
+{
+ local cur prev words cword
+ _init_completion -n = || return
+
+ case "$prev" in
+ -G)
+ COMPREPLY=( $( compgen -W '$( cpack --help 2>/dev/null |
+ grep "^ .*=\ .*" 2> /dev/null | grep -v "^ -" 2>/dev/null |
+ cut -d" " -f 3 )' -- "$cur" ) )
+ return
+ ;;
+ -C)
+ COMPREPLY=( $( compgen -W 'Debug Release RelWithDebInfo
+ MinSizeRel' -- "$cur" ) )
+ return
+ ;;
+ -D)
+ [[ $cur == *=* ]] && return # no completion for values
+ COMPREPLY=( $( compgen -W '$( cpack --help-variable-list \
+ 2>/dev/null | tail -n +2 )' -S = -- "$cur" ) )
+ compopt -o nospace
+ return
+ ;;
+ -P|-R|--vendor)
+ # argument required but no completions available
+ return
+ ;;
+ -B)
+ _filedir -d
+ return
+ ;;
+ --config)
+ _filedir
+ return
+ ;;
+ --help-command)
+ COMPREPLY=( $( compgen -W '$( cpack --help-command-list 2>/dev/null|
+ tail -n +2 )' -- "$cur" ) )
+ return
+ ;;
+ --help-variable)
+ COMPREPLY=( $( compgen -W '$( cpack --help-variable-list \
+ 2>/dev/null | tail -n +2 )' -- "$cur" ) )
+ return
+ ;;
+ esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $(compgen -W '$( _parse_help "$1" --help )' -- ${cur}) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ [[ $COMPREPLY ]] && return
+ fi
+
+ _filedir
+} &&
+complete -F _cpack cpack
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/cpack.exp b/test/completion/cpack.exp
new file mode 100644
index 00000000..106aad6d
--- /dev/null
+++ b/test/completion/cpack.exp
@@ -0,0 +1 @@
+assert_source_completions cpack
diff --git a/test/lib/completions/cpack.exp b/test/lib/completions/cpack.exp
new file mode 100644
index 00000000..7b3f8314
--- /dev/null
+++ b/test/lib/completions/cpack.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+assert_complete_any "cpack "
+
+
+sync_after_int
+
+
+teardown