Merge topic 'CMake-bash-completion-enhance'

4d253d1 Enhance bash completion file for cmake and ctest
This commit is contained in:
David Cole 2012-01-09 14:09:55 -05:00 committed by CMake Topic Stage
commit e1c07a4342
1 changed files with 16 additions and 9 deletions

View File

@ -51,13 +51,20 @@ _cmake()
COMPREPLY=( $(compgen -W "${running}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
return 0 return 0
;; ;;
# FIXME: don't know how to handle multi words completion
# or more precisely word that contains space in them like "Unix Makefiles"
# -G)
# local running=$(for x in `cmake --help | grep "^ .*=\ .*" | grep -v "^ -" | cut -d"=" -f 1 | grep -v "^ "`; do echo \"${x}\" ; done )
# COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
# return 0
# ;;
--help-command) --help-command)
local running=$(for x in `cmake --help-command-list`; do echo ${x} ; done ) local running=$(for x in `cmake --help-command-list | grep -v "cmake version"`; do echo ${x} ; done )
COMPREPLY=( $(compgen -W "${running}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
return 0 return 0
;; ;;
--help-module) --help-module)
local running=$(for x in `cmake --help-module-list`; do echo ${x} ; done ) local running=$(for x in `cmake --help-module-list | grep -v "cmake version"`; do echo ${x} ; done )
COMPREPLY=( $(compgen -W "${running}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
return 0 return 0
;; ;;
@ -67,12 +74,12 @@ _cmake()
return 0 return 0
;; ;;
--help-property) --help-property)
local running=$(for x in `cmake --help-property-list`; do echo ${x} ; done ) local running=$(for x in `cmake --help-property-list | grep -v "cmake version"`; do echo ${x} ; done )
COMPREPLY=( $(compgen -W "${running}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
return 0 return 0
;; ;;
--help-variable) --help-variable)
local running=$(for x in `cmake --help-variable-list`; do echo ${x} ; done ) local running=$(for x in `cmake --help-variable-list | grep -v "cmake version"`; do echo ${x} ; done )
COMPREPLY=( $(compgen -W "${running}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
return 0 return 0
;; ;;
@ -128,14 +135,14 @@ _cpack()
esac esac
# #
# Complete the option (Level 0 - right after cmake) # Complete the option (Level 0 - right after cpack)
# #
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
} && } &&
complete -F _cpack -o default cpack complete -F _cpack -o default cpack
# #
# cmake command # ctest command
# #
# have ctest && # have ctest &&
_ctest() _ctest()
@ -156,11 +163,11 @@ _ctest()
# #
case "${prev}" in case "${prev}" in
--help-command) --help-command)
local running=$(for x in `ctest --help-command-list`; do echo ${x} ; done ) local running=$(for x in `ctest --help-command-list | grep -v "ctest version" `; do echo ${x} ; done )
COMPREPLY=( $(compgen -W "${running}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
return 0 return 0
;; ;;
-R) -R|-E)
local running=$(for x in `ctest -N 2> /dev/null | grep "^ Test" | cut -d: -f 2`; do echo ${x} ; done ) local running=$(for x in `ctest -N 2> /dev/null | grep "^ Test" | cut -d: -f 2`; do echo ${x} ; done )
COMPREPLY=( $(compgen -W "${running}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${running}" -- ${cur}) )
return 0 return 0