|
2 | 2 |
|
3 | 3 | # Filter the array elements with the specified condition. |
4 | 4 | # @param $1 Array name (that is not "value" or other internal variable names) |
5 | | -# @param $2 When none of the options -EFG are specified, this is used as the |
6 | | -# command that tests the array element. The command is supposed to exit with |
7 | | -# status 0 when the element should be preserved, and 1 when the element |
8 | | -# should be removed. The other exit status will cancel the array filtering. |
9 | | -# If this is an existing function name, the function is called with the value |
10 | | -# of the array element. Otherwise, this shall be the shell command that |
11 | | -# tests the array-element value stored in the shell variable "value". |
| 5 | +# @param $2 When any of the options `-EFG' is specified, the second argument is |
| 6 | +# used as a pattern string whose meaning is determined by the option `-EFG'. |
| 7 | +# Otherwise, the second argument specifies the command that tests the array |
| 8 | +# element. The command is supposed to exit with: |
| 9 | +# |
| 10 | +# status 0 .... when the element should be preserved |
| 11 | +# status 1 .... when the element should be removed |
| 12 | +# status 27 ... when the loop should be canceled. All the remaining |
| 13 | +# elements will be preserved regardless of the presence of |
| 14 | +# option `-r'. |
| 15 | +# |
| 16 | +# The other exit status will cancel the array filtering. If this is an |
| 17 | +# existing command name, the function is called with the value of the array |
| 18 | +# element. Otherwise, this shall be the shell command that tests the |
| 19 | +# array-element value stored in the shell variable "value". |
12 | 20 | # |
13 | 21 | # Options: |
14 | 22 | # -E $2 is interpreted as a POSIX extended regular expression. |
@@ -114,6 +122,7 @@ _comp_xfunc_ARRAY_filter() |
114 | 122 | unset -v "$1[\$_comp_local_index]" |
115 | 123 | _comp_local_unset=1 |
116 | 124 | ;; |
| 125 | + 27) break ;; |
117 | 126 | *) |
118 | 127 | printf 'bash_completion: %s: %s\n' "$FUNCNAME" \ |
119 | 128 | "the filter condition broken '${_comp_local_pattype:+-$_comp_local_pattype }$2'" >&2 |
|
0 commit comments