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

Re: [PATCH] new completion for "sv"



fREW Schmidt wrote:
> Ok, I think I did this right this time.

Looks good.

> ok, I switched it to use _alternative and 3 functions as seems to be
> somewhat common in other compltion scripts in the codebase.

At least based on the documentation, _alternative is supposed to take
_arguments like specifications. Apparently it works with a list of
functions as you have done. An example would be:

_alternative \
  'additional-commands:additional command:((check\:check\ status\ of\ service))' \
  'lsb-commands: : _describe -t lsb-commands "LSB command" sv_lsb_ary' \
  'sv-commands:sv command:_sv_commands'

> This raises an interesting question.  I did what you said, but as
> Christian Neukirchen pointed out, on his system the default SVDIR is
> /var/service, and on ubuntu the default is /etc/service.  I guess it's
> up to the packager to tweak the script or something?

I guess it could try to find out what distribution you have by checking
for release files in /etc and choosing a suitable default accordingly.

> Additionally, I like Christian Neukirchen's single-character shortcut
> completion.  For majority of the commands they work already since
> nothing else starts with that letter, but s and c both have multiple
> options.  If I understood what I was doing more I'd take his idea, but
> I don't.

I'm not sure that I do like it because it is a departure from the way
completion normally works: "s" will complete to status but not
start or stop while "st" will offer all three. It is possible to
configure this using tag-order and ignored-patterns styles.

>  Completion/Unix/Command/_sv | 73 +++++++++++++++++++++++++++++++++++++++++++++

One thing I forgot to mention is that it should be named _runit:
functions are normally named after the software rather than the command,
e.g. _subversion for svn.

Oliver



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