zsh-users
 help / color / Atom feed
* When _alternative separates the options?
@ 2019-10-20 13:08 Sebastian Gniazdowski
  2019-10-20 21:22 ` dana
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Gniazdowski @ 2019-10-20 13:08 UTC (permalink / raw)
  To: Zsh Users

Hello,
when writing:

https://github.com/psprint/zunit/blob/zunit-completion/_zunit

I've had a problem: the options given to _alternative were merged
together, i.e. it was looking like this:

zunit options
zunit command
--allow-risky      -- Supress warnings generated for risky tests
init  -- Bootstrap zunit in a new project
...

instead of:

zunit options
--allow-risky      -- Supress warnings generated for risky tests
...
zunit command
init  -- Bootstrap zunit in a new project
...

However, the problem resolved itself when I've separated the options
from the form:

"--help,-h":"Output help text and exit"

to the form:

"--help":"Output help text and exit"
"-h":"Output help text and exit"

in the array. I would now like to separate the directories and plugins
in the following _alternative call:

https://github.com/zdharma/zplugin/blob/208092/_zplugin#L90

How to do this?

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

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

* Re: When _alternative separates the options?
  2019-10-20 13:08 When _alternative separates the options? Sebastian Gniazdowski
@ 2019-10-20 21:22 ` dana
  2019-10-21  9:42   ` Sebastian Gniazdowski
  0 siblings, 1 reply; 5+ messages in thread
From: dana @ 2019-10-20 21:22 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: Zsh Users

On 20 Oct 2019, at 08:08, Sebastian Gniazdowski <sgniazdowski@gmail.com> wrote:
> I would now like to separate the directories and plugins in the following
> _alternative call:
>
> https://github.com/zdharma/zplugin/blob/208092/_zplugin#L90
>
> How to do this?

http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Standard-Styles

zstyle ':completion:*' group-name ''

(or ':completion:*:*:zunit:*' or whatever is appropriate)

dana


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

* Re: When _alternative separates the options?
  2019-10-20 21:22 ` dana
@ 2019-10-21  9:42   ` Sebastian Gniazdowski
  2019-10-21 10:06     ` Oliver Kiddle
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Gniazdowski @ 2019-10-21  9:42 UTC (permalink / raw)
  To: dana; +Cc: Zsh Users

On Sun, 20 Oct 2019 at 23:22, dana <dana@dana.is> wrote:
>
> On 20 Oct 2019, at 08:08, Sebastian Gniazdowski <sgniazdowski@gmail.com> wrote:
> > I would now like to separate the directories and plugins in the following
> > _alternative call:
> >
> > https://github.com/zdharma/zplugin/blob/208092/_zplugin#L90
> >
> > How to do this?
>
> http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Standard-Styles
>
> zstyle ':completion:*' group-name ''
>
> (or ':completion:*:*:zunit:*' or whatever is appropriate)

Thanks, it works for separating the files and directories, however not
for separating the results added with compadd:

_alternative 'snippets:downloaded snippets:compadd -a - snippets' \
     'snippets:already loaded snippets:compadd -a - snippets_alreadyld' \
     'files:file:_files' && \
         ret=1

The "downloaded snippets" and "already loaded snippets" will be
merged. Is there a way to separate those?

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

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

* Re: When _alternative separates the options?
  2019-10-21  9:42   ` Sebastian Gniazdowski
@ 2019-10-21 10:06     ` Oliver Kiddle
  2019-10-21 10:31       ` Sebastian Gniazdowski
  0 siblings, 1 reply; 5+ messages in thread
From: Oliver Kiddle @ 2019-10-21 10:06 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: Zsh Users

Sebastian Gniazdowski wrote:
> _alternative 'snippets:downloaded snippets:compadd -a - snippets' \
>      'snippets:already loaded snippets:compadd -a - snippets_alreadyld' \
>      'files:file:_files' && \
>          ret=1
>
> The "downloaded snippets" and "already loaded snippets" will be
> merged. Is there a way to separate those?

Try giving them a different tag. Otherwise they will end up in the same
group. So something like:

  _alternative \
    'downloaded-snippets:downloaded snippet:compadd -a - snippets' \
    'already-loaded-snippets:already loaded snippet:compadd -a - snippets_alreadyld'
    ...

As an aside, the normal zsh convention is plural form for the tags and
singular for the group descriptions.

Oliver

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

* Re: When _alternative separates the options?
  2019-10-21 10:06     ` Oliver Kiddle
@ 2019-10-21 10:31       ` Sebastian Gniazdowski
  0 siblings, 0 replies; 5+ messages in thread
From: Sebastian Gniazdowski @ 2019-10-21 10:31 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: Zsh Users

On Mon, 21 Oct 2019 at 12:06, Oliver Kiddle <okiddle@yahoo.co.uk> wrote:
>
> Sebastian Gniazdowski wrote:
> > _alternative 'snippets:downloaded snippets:compadd -a - snippets' \
> >      'snippets:already loaded snippets:compadd -a - snippets_alreadyld' \
> >      'files:file:_files' && \
> >          ret=1
> >
> > The "downloaded snippets" and "already loaded snippets" will be
> > merged. Is there a way to separate those?
>
> Try giving them a different tag. Otherwise they will end up in the same
> group. So something like:
>
>   _alternative \
>     'downloaded-snippets:downloaded snippet:compadd -a - snippets' \
>     'already-loaded-snippets:already loaded snippet:compadd -a - snippets_alreadyld'
>     ...
>
> As an aside, the normal zsh convention is plural form for the tags and
> singular for the group descriptions.

Thanks, it helped.

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-20 13:08 When _alternative separates the options? Sebastian Gniazdowski
2019-10-20 21:22 ` dana
2019-10-21  9:42   ` Sebastian Gniazdowski
2019-10-21 10:06     ` Oliver Kiddle
2019-10-21 10:31       ` Sebastian Gniazdowski

zsh-users

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-users

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.users


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git