I have zsh completion for custom script, where one parameter must be URL (ie, string) and then there are several optional parameters: --AAA --BBB --CCC:
_arguments -S : \
'--AAA' \
'--BBB' \
'--CCC' \
'1: :'
however, the completion only works after URL parameter has been provided, ie:
myscript URL --A<TAB>
this will autocomplete --AAA
But when I have:
myscript --A<TAB>
then it will list the only matching option --AAA, but it will not autocomplete it even if I do --AA<TAB>
. I have to type it manually.
When I change my completion script to:
_arguments -S : \
'--AAA' \
'--BBB' \
'--CCC'
autocompletion of parameters works, but as soon as I provide URL, no other options are completed.
So how do I tell zsh completion, that my script expects one URL (ie one string argument - I don't want zsh to start completing filenemes in current location), and optional parameters can be completed either before, or after this URL?
Note: I am not trying to autocomplete URL. I am just trying to have completion work both before and after this one URL string.