diff options
author | Igor Murzov <e-mail@date.by> | 2013-07-29 22:39:53 (GMT) |
---|---|---|
committer | Igor Murzov <e-mail@date.by> | 2013-07-29 23:13:08 (GMT) |
commit | f85f6a5e795e7c552944a885a1f5f978fa847433 (patch) | |
tree | 165a5524491228c158da80f047198df7753c2e8c | |
parent | 351fd63ef5d8f24955b3e061fd43c1c9f1aa570d (diff) | |
download | CMake-f85f6a5e795e7c552944a885a1f5f978fa847433.zip CMake-f85f6a5e795e7c552944a885a1f5f978fa847433.tar.gz CMake-f85f6a5e795e7c552944a885a1f5f978fa847433.tar.bz2 |
bash-completion: Fix/improve generator names extraction
-rw-r--r-- | Docs/bash-completion/cmake | 8 | ||||
-rw-r--r-- | Docs/bash-completion/cpack | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/Docs/bash-completion/cmake b/Docs/bash-completion/cmake index 59b565a..5f33c09 100644 --- a/Docs/bash-completion/cmake +++ b/Docs/bash-completion/cmake @@ -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) diff --git a/Docs/bash-completion/cpack b/Docs/bash-completion/cpack index a0c1f83..51638c5 100644 --- a/Docs/bash-completion/cpack +++ b/Docs/bash-completion/cpack @@ -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) |