Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

sub-command completion



Hello, I am trying to understand if it is possible to control the behavior
of _gnu_generic completion.
I have a command which defines different options if a non-option first
argument has already been inserted on the command line, eg:

command -x -y sub-command

I have defined a custom completion function like this:

<----- CODE
# omissis code to populate the vars description_array and commands_array

if [[ ${words[-1]} == -* ]]
then
_gnu_generic
else
_arguments -s -S -A '-*' \
"1:commands:->commands" \
"*:files:_files"
fi

case $state in
(commands)
compadd -V commands -a -l -d description_array -Q -U commands_array
  ;;
esac

CODE ----->

Now I would like to make _gnu_generic complete with the options offered by:

command subcommand --help

when a subcommand has already been inserted on the command line. But I
can't figure out how to do so, can anyone help me out?

thanks

Pier Paolo Grassi
linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217
founder: https://www.meetup.com/it-IT/Machine-Learning-TO


Messages sorted by: Reverse Date, Date, Thread, Author