Make tools/bash-completion.sh robust against arbitrary CWD

R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/168983006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19427 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0213f7ac
......@@ -37,7 +37,7 @@ v8_source=$(readlink -f $(dirname $BASH_SOURCE)/..)
_v8_flag() {
local cur defines targets
cur="${COMP_WORDS[COMP_CWORD]}"
defines=$(cat src/flag-definitions.h \
defines=$(cat $v8_source/src/flag-definitions.h \
| grep "^DEFINE" \
| grep -v "DEFINE_implication" \
| sed -e 's/_/-/g')
......@@ -45,7 +45,7 @@ _v8_flag() {
| sed -ne 's/^DEFINE-[^(]*(\([^,]*\).*/--\1/p'; \
echo "$defines" \
| sed -ne 's/^DEFINE-bool(\([^,]*\).*/--no\1/p'; \
cat src/d8.cc \
cat $v8_source/src/d8.cc \
| grep "strcmp(argv\[i\]" \
| sed -ne 's/^[^"]*"--\([^"]*\)".*/--\1/p')
COMPREPLY=($(compgen -W "$targets" -- "$cur"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment