diff options
author | Eric NOULARD <eric.noulard@gmail.com> | 2012-04-22 17:08:29 (GMT) |
---|---|---|
committer | Eric NOULARD <eric.noulard@gmail.com> | 2012-04-23 18:46:08 (GMT) |
commit | 5b97942cbb915e8eaff0b5b9fee0676296656c93 (patch) | |
tree | 2bef7e23ab8f6aa7903f8cedebd9a9a094e2d6e7 /Docs/bash-completion/cpack | |
parent | 3a503926018fd10ef2120e2c1b98e93afb4fd0c1 (diff) | |
download | CMake-5b97942cbb915e8eaff0b5b9fee0676296656c93.zip CMake-5b97942cbb915e8eaff0b5b9fee0676296656c93.tar.gz CMake-5b97942cbb915e8eaff0b5b9fee0676296656c93.tar.bz2 |
Enhancement of bash completion scripts given by Igor Murzov.
The orginal patch has been reworked in order to follow
CMake source tree layout habit.
Inspired-By: Igor Murzov <e-mail@date.by>
Diffstat (limited to 'Docs/bash-completion/cpack')
-rw-r--r-- | Docs/bash-completion/cpack | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Docs/bash-completion/cpack b/Docs/bash-completion/cpack new file mode 100644 index 0000000..84dcfd5 --- /dev/null +++ b/Docs/bash-completion/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 |