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

Unified Diff: src/scripts/bash_completion

Issue 1595001: New autotest wrapper script and bash complete support. (Closed)
Patch Set: patch 6 Created 10 years, 9 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 | « src/scripts/autotest.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scripts/bash_completion
diff --git a/src/scripts/bash_completion b/src/scripts/bash_completion
index 5b74b1f131bbd48803e2f65b025d9cbc469f8c9a..e114e5e4e195041d073a7d75749495da6dade63b 100644
--- a/src/scripts/bash_completion
+++ b/src/scripts/bash_completion
@@ -73,17 +73,23 @@ _board_sysroots()
fi
}
-# Completion for --board= argument for existing board sysroots
-#
-_board_sysroot()
+_complete_board_sysroot_flag()
{
- _flag_complete && return 0
-
COMPREPLY=()
local arg=$(_argeq --board)
if [[ ${arg} == --board=* ]]; then
COMPREPLY=( $(compgen -W "$(_board_sysroots)" -- ${arg#--board=}) )
+ return 0
fi
+ return 1
+}
+
+# Completion for --board= argument for existing board sysroots
+#
+_board_sysroot()
+{
+ _flag_complete && return 0
+ _complete_board_flag && return 0
}
complete -o bashdefault -o default -F _board_sysroot \
@@ -119,6 +125,33 @@ _board_overlay()
complete -o bashdefault -o default -F _board_overlay setup_board
+# Completion for -c and -s argument for autotest script
+_ls_autotest() {
+ local autotest_dir=../third_party/autotest/files
+ ls --color=never -dBFH ${autotest_dir}/$1* 2>/dev/null |\
+ sed s/"..\/third_party\/autotest\/files\/"//g
+}
+
+_autotest_complete()
+{
+ _flag_complete && return 0
+
+ local arg=$(_argeq -c)
+ if [[ ${arg} == -c=* ]]; then
+ COMPREPLY=($(compgen -W "$(_ls_autotest ${arg#-c=})"))
+ return 0
+ fi
+
+ arg=$(_argeq -s)
+ if [[ ${arg} == -s=* ]]; then
+ COMPREPLY=($(compgen -W "$(_ls_autotest ${arg#-s=})"))
+ return 0
+ fi
+
+ _complete_board_sysroot_flag && return 0
+}
+
+complete -o bashdefault -o default -o nospace -F _autotest_complete autotest
### Local Variables:
### mode: shell-script
« no previous file with comments | « src/scripts/autotest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698