Skip to content

Commit

Permalink
[core/completion] Support scalar COMPREPLY with compgen -F
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Jan 2, 2025
1 parent 1b10aa4 commit d9b36e6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,10 @@ def Matches(self, comp):
self.func.name)
return

elif case(value_e.Str):
val = cast(value.Str, UP_val)
strs = [val.s]

elif case(value_e.BashArray):
val = cast(value.BashArray, UP_val)
strs = bash_impl.BashArray_GetValues(val)
Expand Down
13 changes: 13 additions & 0 deletions spec/builtin-completion.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -625,3 +625,16 @@ argv.py "${words[@]}"

## N-I bash STDOUT:
## END


#### compgen -F with scalar COMPREPLY

_comp_cmd_test() {
unset -v COMPREPLY
COMPREPLY=hello
}
compgen -F _comp_cmd_test

## STDOUT:
hello
## END

0 comments on commit d9b36e6

Please sign in to comment.