bash-completion: Fix/improve generator names extraction

This commit is contained in:
Igor Murzov 2013-07-30 02:39:53 +04:00
parent 351fd63ef5
commit f85f6a5e79
2 changed files with 7 additions and 5 deletions

View File

@ -100,11 +100,13 @@ _cmake()
return return
;; ;;
-G) -G)
# FIXME: doesn't work properly
local IFS=$'\n' local IFS=$'\n'
local quoted
printf -v quoted %q "$cur"
COMPREPLY=( $( compgen -W '$( cmake --help 2>/dev/null | sed -n \ COMPREPLY=( $( compgen -W '$( cmake --help 2>/dev/null | sed -n \
"/^.*[^ ].*= Generates/{s|^ *\(.*[^ ]\) *= Generates.*$|\1|;s| |\\\\ |g;p}" \ -e "1,/^Generators/d" \
2>/dev/null )' -- "$cur" ) ) -e "/^ *[^ =]/{s|^ *\([^=]*[^ =]\).*$|\1|;s| |\\\\ |g;p}" \
2>/dev/null )' -- "$quoted" ) )
return return
;; ;;
--help-command) --help-command)

View File

@ -8,8 +8,8 @@ _cpack()
case "$prev" in case "$prev" in
-G) -G)
COMPREPLY=( $( compgen -W '$( cpack --help 2>/dev/null | COMPREPLY=( $( compgen -W '$( cpack --help 2>/dev/null |
grep "^ .*= .*" 2> /dev/null | grep -v "^ -" 2>/dev/null | sed -e "1,/^Generators/d" -e "s|^ *\([^ ]*\) .*$|\1|" \
cut -d" " -f 3 )' -- "$cur" ) ) 2>/dev/null )' -- "$cur" ) )
return return
;; ;;
-C) -C)