summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--completion.bash22
1 files changed, 21 insertions, 1 deletions
diff --git a/completion.bash b/completion.bash
index 6a5bfe1c..09291d5c 100644
--- a/completion.bash
+++ b/completion.bash
@@ -14,6 +14,9 @@
14 14
15# Programmable bash completion. https://github.com/scop/bash-completion 15# Programmable bash completion. https://github.com/scop/bash-completion
16 16
17# TODO: Handle interspersed options. We handle `repo h<tab>`, but not
18# `repo --time h<tab>`.
19
17# Complete the list of repo subcommands. 20# Complete the list of repo subcommands.
18__complete_repo_list_commands() { 21__complete_repo_list_commands() {
19 local repo=${COMP_WORDS[0]} 22 local repo=${COMP_WORDS[0]}
@@ -79,6 +82,23 @@ __complete_repo_command_help() {
79 fi 82 fi
80} 83}
81 84
85# Complete `repo forall`.
86__complete_repo_command_forall() {
87 local current=$1
88 # CWORD=1 is "forall".
89 # CWORD=2+ are <projects> *until* we hit the -c option.
90 local i
91 for (( i = 0; i < COMP_CWORD; ++i )); do
92 if [[ "${COMP_WORDS[i]}" == "-c" ]]; then
93 return 0
94 fi
95 done
96
97 COMPREPLY=(
98 $(compgen -W "$(__complete_repo_list_projects)" -- "${current}")
99 )
100}
101
82# Complete `repo start`. 102# Complete `repo start`.
83__complete_repo_command_start() { 103__complete_repo_command_start() {
84 local current=$1 104 local current=$1
@@ -112,7 +132,7 @@ __complete_repo_arg() {
112 return 0 132 return 0
113 ;; 133 ;;
114 134
115 help|start) 135 help|start|forall)
116 __complete_repo_command_${command} "${current}" 136 __complete_repo_command_${command} "${current}"
117 return 0 137 return 0
118 ;; 138 ;;