From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] Completion batch #5: Simple Darwin and Linux utilities
Date: Sat, 06 Jan 2018 00:50:33 +0100 [thread overview]
Message-ID: <26360.1515196233@thecus.kiddle.eu> (raw)
In-Reply-To: <4553C21B-67DD-4E1C-BE56-F662E63F7FF5@dana.is>
dana wrote:
> New functions for simple utilities belonging to the 'Darwin' and 'Linux' groups.
Thanks, I've committed these.
That is with the exception of Linux/Command/_ldd – there's already a
completion for ldd in Unix/Command that also handles Solaris and the
BSDs. ldconfig also exists outside of Linux but in a different form so
may need moving later.
> +[[ $state == variables-* ]] && {
> + tmp=( ${${(f)"$( command $service -p )"}%%[[:space:]]*} )
Ideally, you should use _call_program when calling external commands as
that allows the program to be disabled or overridden. It is also better
in general to use $words[1] instead of $service in case a command is
specified by the user with a full path and there's another version of
the command elsewhere in $PATH.
> +#compdef plutil
> +local -a context line state state_descr tmp fmts=( xml1 binary1 json )
> +_arguments -s -S : \
> + '(-convert -extract -replace -remove)-insert[insert value at specified key path into property list]: :->k: :->t: :->v' \
> + _values 'value type' $tmp && ret=0
To elaborate on what I was explaining with contexts, after completion with:
plutil -insert <tab>
_arguments will set context=( set2-option-insert-1 )
The idea is that when looking up styles with zstyle, this should be
included. Unlike _wanted, _alternative, _tags and others, this can't be
passed on to _values other than in $curcontext. So in this case, using
_arguments -C might be better.
> +# Don't complete host names unless we have -r (this is weird, but the obvious
> +# alternative (exclusion sets) currently doesn't work properly with option
> +# stacking)
Can you elaborate on what doesn't work here? Sets have some oddities and
are often better avoided.
Oliver
next prev parent reply other threads:[~2018-01-05 23:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-05 20:26 dana
2018-01-05 23:50 ` Oliver Kiddle [this message]
2018-01-06 0:28 ` dana
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=26360.1515196233@thecus.kiddle.eu \
--to=okiddle@yahoo.co.uk \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).