diff options
-rw-r--r-- | completion.bash | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/completion.bash b/completion.bash index 3c1fd683..04347ce3 100644 --- a/completion.bash +++ b/completion.bash | |||
@@ -66,6 +66,31 @@ __complete_repo_command_projects() { | |||
66 | COMPREPLY=($(compgen -W "$(__complete_repo_list_projects)" -- "${current}")) | 66 | COMPREPLY=($(compgen -W "$(__complete_repo_list_projects)" -- "${current}")) |
67 | } | 67 | } |
68 | 68 | ||
69 | # Complete `repo help`. | ||
70 | __complete_repo_command_help() { | ||
71 | local current=$1 | ||
72 | # CWORD=1 is "start". | ||
73 | # CWORD=2 is the <subcommand> which we complete here. | ||
74 | if [[ ${COMP_CWORD} -eq 2 ]]; then | ||
75 | COMPREPLY=( | ||
76 | $(compgen -W "$(__complete_repo_list_commands)" -- "${current}") | ||
77 | ) | ||
78 | fi | ||
79 | } | ||
80 | |||
81 | # Complete `repo start`. | ||
82 | __complete_repo_command_start() { | ||
83 | local current=$1 | ||
84 | # CWORD=1 is "start". | ||
85 | # CWORD=2 is the <branch> which we don't complete. | ||
86 | # CWORD=3+ are <projects> which we complete here. | ||
87 | if [[ ${COMP_CWORD} -gt 2 ]]; then | ||
88 | COMPREPLY=( | ||
89 | $(compgen -W "$(__complete_repo_list_projects)" -- "${current}") | ||
90 | ) | ||
91 | fi | ||
92 | } | ||
93 | |||
69 | # Complete the repo subcommand arguments. | 94 | # Complete the repo subcommand arguments. |
70 | __complete_repo_arg() { | 95 | __complete_repo_arg() { |
71 | if [[ ${COMP_CWORD} -le 1 ]]; then | 96 | if [[ ${COMP_CWORD} -le 1 ]]; then |
@@ -86,21 +111,8 @@ __complete_repo_arg() { | |||
86 | return 0 | 111 | return 0 |
87 | ;; | 112 | ;; |
88 | 113 | ||
89 | help) | 114 | help|start) |
90 | if [[ ${COMP_CWORD} -eq 2 ]]; then | 115 | __complete_repo_command_${command} "${current}" |
91 | COMPREPLY=( | ||
92 | $(compgen -W "$(__complete_repo_list_commands)" -- "${current}") | ||
93 | ) | ||
94 | fi | ||
95 | return 0 | ||
96 | ;; | ||
97 | |||
98 | start) | ||
99 | if [[ ${COMP_CWORD} -gt 2 ]]; then | ||
100 | COMPREPLY=( | ||
101 | $(compgen -W "$(__complete_repo_list_projects)" -- "${current}") | ||
102 | ) | ||
103 | fi | ||
104 | return 0 | 116 | return 0 |
105 | ;; | 117 | ;; |
106 | 118 | ||