zsh-users
 help / color / mirror / code / Atom feed
* sub-command completion
@ 2019-08-29  9:48 Pier Paolo Grassi
  2019-09-02 15:56 ` Pier Paolo Grassi
  0 siblings, 1 reply; 2+ messages in thread
From: Pier Paolo Grassi @ 2019-08-29  9:48 UTC (permalink / raw)
  To: Zsh-Users List

[-- Attachment #1: Type: text/plain, Size: 1027 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: sub-command completion
  2019-08-29  9:48 sub-command completion Pier Paolo Grassi
@ 2019-09-02 15:56 ` Pier Paolo Grassi
  0 siblings, 0 replies; 2+ messages in thread
From: Pier Paolo Grassi @ 2019-09-02 15:56 UTC (permalink / raw)
  To: Zsh-Users List

[-- Attachment #1: Type: text/plain, Size: 1472 bytes --]

Sorry for the previous posting, the mail I wanted to ask again for
suggestions is the one quoted here
any help appreciated, thanks!

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


Il giorno gio 29 ago 2019 alle ore 11:48 Pier Paolo Grassi <
pierpaolog@gmail.com> ha scritto:

> 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
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-02 15:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-29  9:48 sub-command completion Pier Paolo Grassi
2019-09-02 15:56 ` Pier Paolo Grassi

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).