OLD | NEW |
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # Add programmable completion to some Chromium OS build scripts | 5 # Add programmable completion to some Chromium OS build scripts |
6 | 6 |
7 | 7 |
8 # Echo a list of -- flags that the current command accepts. The | 8 # Echo a list of -- flags that the current command accepts. The |
9 # function assumes that the command supports shflags' --help flag. | 9 # function assumes that the command supports shflags' --help flag. |
10 _flags() { | 10 _flags() { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 126 } |
127 | 127 |
128 # Complete cros_workon's <command> argument. | 128 # Complete cros_workon's <command> argument. |
129 # | 129 # |
130 # TODO(petkov): We should probably extract the list of commands from | 130 # TODO(petkov): We should probably extract the list of commands from |
131 # cros_workon --help, just like we do for flags (see _flag_complete). | 131 # cros_workon --help, just like we do for flags (see _flag_complete). |
132 # | 132 # |
133 # TODO(petkov): Currently, this assumes that the command is the first | 133 # TODO(petkov): Currently, this assumes that the command is the first |
134 # argument. In practice, the command is the first non-flag | 134 # argument. In practice, the command is the first non-flag |
135 # argument. I.e., this should be fixed to support something like | 135 # argument. I.e., this should be fixed to support something like |
136 # "./cros_workon --all list". | 136 # "cros_workon --all list". |
137 _complete_cros_workon_command() { | 137 _complete_cros_workon_command() { |
138 [ ${COMP_CWORD} -eq 1 ] || return 1 | 138 [ ${COMP_CWORD} -eq 1 ] || return 1 |
139 local command="${COMP_WORDS[1]}" | 139 local command="${COMP_WORDS[1]}" |
140 COMPREPLY=($(compgen -W "start stop list iterate" -- "$command")) | 140 COMPREPLY=($(compgen -W "start stop list iterate" -- "$command")) |
141 return 0 | 141 return 0 |
142 } | 142 } |
143 | 143 |
144 # Prints the full path to the cros_workon executable, handling tilde | 144 # Prints the full path to the cros_workon executable, handling tilde |
145 # expansion for the current user. | 145 # expansion for the current user. |
146 _cros_workon_executable() { | 146 _cros_workon_executable() { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 image_to_usb.sh \ | 253 image_to_usb.sh \ |
254 mod_image_for_test.sh | 254 mod_image_for_test.sh |
255 complete -o bashdefault -o default -F _board_overlay setup_board | 255 complete -o bashdefault -o default -F _board_overlay setup_board |
256 complete -o bashdefault -o default -o nospace -F _autotest_complete autotest | 256 complete -o bashdefault -o default -o nospace -F _autotest_complete autotest |
257 complete -F _cros_workon cros_workon | 257 complete -F _cros_workon cros_workon |
258 complete -F _complete_repo repo | 258 complete -F _complete_repo repo |
259 | 259 |
260 ### Local Variables: | 260 ### Local Variables: |
261 ### mode: shell-script | 261 ### mode: shell-script |
262 ### End: | 262 ### End: |
OLD | NEW |