summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Odgaard <git@abetarda.com>2014-04-15 07:23:47 (GMT)
committerAllan Odgaard <git@abetarda.com>2014-04-15 07:27:57 (GMT)
commit1f38478eb976d3c11db7885972664c0422317ea8 (patch)
treeebdf50937fbb514975848a44eb821343c87db18f
parent7603f0fbbe6395de8155c2d311e92ece8ba36dd6 (diff)
downloadNinja-1f38478eb976d3c11db7885972664c0422317ea8.zip
Ninja-1f38478eb976d3c11db7885972664c0422317ea8.tar.gz
Ninja-1f38478eb976d3c11db7885972664c0422317ea8.tar.bz2
Fix bash completion when using command options
By quoting the ‘line’ variable we are making it a single word, but ‘getopts’ wants each option as its own word. Previously bash completion would output an error for a line like: ‘ninja -vn targ‸’. In addition to removing the quotes (to enable word expansion) I also used it as a regular variable, as that is what it is (not an array).
-rw-r--r--misc/bash-completion2
1 files changed, 1 insertions, 1 deletions
diff --git a/misc/bash-completion b/misc/bash-completion
index 2d6975b..93bc9a1 100644
--- a/misc/bash-completion
+++ b/misc/bash-completion
@@ -26,7 +26,7 @@ _ninja_target() {
dir="."
line=$(echo ${COMP_LINE} | cut -d" " -f 2-)
# filter out all non relevant arguments but keep C for dirs
- while getopts C:f:j:l:k:nvd:t: opt "${line[@]}"; do
+ while getopts C:f:j:l:k:nvd:t: opt $line; do
case $opt in
C) dir="$OPTARG" ;;
esac