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

View File

@ -8,8 +8,8 @@ _cpack()
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" ) )
sed -e "1,/^Generators/d" -e "s|^ *\([^ ]*\) .*$|\1|" \
2>/dev/null )' -- "$cur" ) )
return
;;
-C)