| Index: tools/bash-completion
|
| diff --git a/tools/bash-completion b/tools/bash-completion
|
| index fce7ea38321b46bac7c1be1243aca50410b921fc..e86767f17026d9ada6dda7741b0509165ed97ad2 100644
|
| --- a/tools/bash-completion
|
| +++ b/tools/bash-completion
|
| @@ -5,6 +5,21 @@
|
| # Flag completion rule for bash.
|
| # To load in your shell, "source path/to/this/file".
|
|
|
| +# Usage examples
|
| +# ==============
|
| +#
|
| +# Browser command line switches:
|
| +# $ out/gn/chrome --site-per-pro<tab>
|
| +# $ google-chrome --site-per-pro<tab>
|
| +#
|
| +# Test switches (i.e. --gtest_* and --test-launcher-* switches):
|
| +# $ out/gn/unit_tests --gtest_filt<tab>
|
| +# $ out/gn/unit_tests --test-launcher-j<tab>
|
| +#
|
| +# Layout test switches:
|
| +# $ third_party/WebKit/Tools/Scripts/run-webkit-tests --additional-driver-f<tab>
|
| +# $ .../run-webkit-tests --additional-driver-flag=--site-per-pro<tab>
|
| +
|
| chrome_source=$(cd $(dirname $BASH_SOURCE)/.. && pwd)
|
|
|
| _chrome_flag() {
|
| @@ -29,6 +44,33 @@ _gtest_flag() {
|
| return 0
|
| }
|
|
|
| +_layout_test_flag() {
|
| + local cur targets webkitpy_dir prev_switch
|
| + cur="${COMP_WORDS[COMP_CWORD]}"
|
| +
|
| + # Complete content_shell switches if appropriate.
|
| + if [ "${COMP_CWORD}" -gt 2 -a "${COMP_WORDS[COMP_CWORD-1]}" = "=" ]
|
| + then
|
| + prev_switch="${COMP_WORDS[COMP_CWORD-2]}"
|
| + if [ "$prev_switch" = "--additional-drt-flag" -o \
|
| + "$prev_switch" = "--additional-driver-flag" ]
|
| + then
|
| + targets=$(cd $chrome_source; \
|
| + git ls-files 'content/*switches*.cc' | \
|
| + xargs sed -ne 's/^[^/]*"\([^" /]\{1,\}\)".*/--\1/p')
|
| + COMPREPLY=($(compgen -W "$targets" -- "$cur"))
|
| + return 0
|
| + fi
|
| + fi
|
| +
|
| + # Complete run-webkit-tests switches.
|
| + webkitpy_dir="$chrome_source/third_party/WebKit/Tools/Scripts/webkitpy"
|
| + targets=$(sed -ne 's/^[[:space:]]*"\(--[a-z-]\+\)",[[:space:]]*$/\1/p' \
|
| + "$webkitpy_dir/layout_tests/run_webkit_tests.py")
|
| + COMPREPLY=($(compgen -W "$targets" -- "$cur"))
|
| + return 0
|
| +}
|
| +
|
| complete -F _chrome_flag google-chrome
|
| complete -F _chrome_flag chrome
|
| if [ $(uname) = "Darwin" ]
|
| @@ -42,3 +84,5 @@ for gtest_test_executable in $(
|
| ); do
|
| complete -F _gtest_flag $gtest_test_executable
|
| done
|
| +
|
| +complete -F _layout_test_flag run-webkit-tests
|
|
|