Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Completion batch #5: Simple Darwin and Linux utilities
- X-seq: zsh-workers 42235
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] Completion batch #5: Simple Darwin and Linux utilities
- Date: Sat, 06 Jan 2018 00:50:33 +0100
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1515196238; bh=KwymdTmeq654Mg2TIAvzZTkBU5cq7DbY+OMWSlrQrx4=; h=From:References:To:Subject:Date:From:Subject; b=Q+vk2ENIZn8AY85eQqpBylXsculjqYIUXuCqpndq5Hyx7apWOSECDc/jAsHYqOULZ+/FRKtVqhzK2LA6Uos7ah83exeN78HpHpc+JTZu6AcMVKnNOZS5/icJM5jhJMqhDwhB1NCrb5jA942c2bHPUf0GX7mIGCKfo2kBOUV/1wt/B9pyV/uD95g3u/ZyuxQNfXrbsVFa8X4I8Mh3DumDHwsyFVcCADMp1owv44F1aR2wSK+jwv+Aay8VGZEflLNL2gVIvwTUp+WErqkVxBOvuu+cuMAC4snU3uIZ5FOIpuDG1BGxHdV72w5g0HtivvjuTlQi0ykQWNa2Rzoa3dRQUA==
- In-reply-to: <4553C21B-67DD-4E1C-BE56-F662E63F7FF5@dana.is>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author