My script foo
takes directories in given path /foo/path
as argument, plus it has one optional argument -l
.
I have this completion file:
#compdef foo
_arguments : \
'-l' \
'*: :->directory'
case $state in
directory)
_directories -W /foo/path
;;
esac
I am having followng issues with the completion:
When I use a wrong (non-existent) optional argument, for example -c
, and then press tab
foo -c <TAB>
then it automatically completes the existent option -l
, as if the directory completion has been eliminated bu the non-existent option -c
.
This is strange, because I would have at least expected it will again offer both the directories, and -l
.
But anyway, if wrong/non-existent option is provided, how can I stop the completions completely, to make clear that it cannot continue with wrong options?
foo -c
, if I press TAB, the completions offered are the directories.