Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Unified Diff: tools/bash-completion

Issue 2436533005: Bash completion support for --gtest_* and --test-launcher-* cmdline switches. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/bash-completion
diff --git a/tools/bash-completion b/tools/bash-completion
index 19172dab145249adf93b5c622988d937993801e4..fce7ea38321b46bac7c1be1243aca50410b921fc 100644
--- a/tools/bash-completion
+++ b/tools/bash-completion
@@ -17,9 +17,28 @@ _chrome_flag() {
return 0
}
+_gtest_flag() {
+ local cur gtest_flags launcher_flags
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ gtest_flags=$(sed -ne 's/^.*FromGTestEnv("\([^" /]\+\)".*$/--gtest_\1/p' \
+ "$chrome_source/testing/gtest/src/gtest.cc")
+ chrome_test_launcher_flags=$(sed -ne 's/^[^/]*"\([^" /]\{1,\}\)".*/--\1/p' \
+ "$chrome_source/base/test/test_switches.cc")
+ COMPREPLY=($(
+ compgen -W "$gtest_flags $chrome_test_launcher_flags" -- "$cur"))
+ return 0
+}
+
complete -F _chrome_flag google-chrome
complete -F _chrome_flag chrome
if [ $(uname) = "Darwin" ]
then
complete -F _chrome_flag Chromium
fi
+
+for gtest_test_executable in $(
+ cd $chrome_source;
+ git ls-files '*/BUILD.gn' | xargs sed -ne 's/^test("\([^"]\+\)").*$/\1/p'
+); do
+ complete -F _gtest_flag $gtest_test_executable
+done
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698