Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] _add-zle-hook-widget: New completion.
- X-seq: zsh-workers 38878
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] _add-zle-hook-widget: New completion.
- Date: Mon, 18 Jul 2016 11:47:57 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1468835278; bh=BqmF/fPcGlNUfDMLRFsOGhsbNOqCy7/EIkqM6Q9HhYE=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=jm8pH5iJ7orwdxg4DqPaVRg0TxgEti3DpX3iFSnUMe8V1PxzdTu2NT+k3REbNcfC0zdBYC5hI0G0d946HpLSugrXIw23a/S3AHWGBc1kgVX8SLrpv/hsAgdPMFe4cTANc49/Vae4BGa/NhRc08FVBtcfnCGLjczdXc3ET21mNsU3qjZgy1mWd/59W85ZD/WF5Vwu8Slk6AjP6e3n0DcU6qgjhj3i9ozhx3JYBWpl3Vdwh7fhCAgnTdN9SbfjTC+5+hOy5O89GbRLU8qXDJDXLGWUGKleL6yyP9A9n4ydsF1Tulqu6pRKWU0TkAll/6MpfbHHKKEaM50Mi83YtwE/XQ==
- In-reply-to: <1468767614-9635-1-git-send-email-danielsh@tarsus.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <160716185103.ZM5258@torch.brasslantern.com> <1468767614-9635-1-git-send-email-danielsh@tarsus.local2>
Daniel Shahaf wrote:
> +local context state state_descr line
> +typeset -A opt_args
Those are only needed if you're using _values or _arguments with states.
This function doesn't so that isn't needed.
> + _wanted widgets expl "installed hooks" compadd -- ${tmp#<->:} && return 0
The description should be singular - "installed hook". Even if you can
specify a list, they are only completed one at a time.
> + else
> + _wanted widgets expl widget compadd -M 'r:|-=* r:|=*' -k widgets && ret=0 && return 0
> + fi
> + return 1
ret was not declared local so ret=0 should not be there.
Actually, all this messing with return codes is superfluous. Given an
if..then..else block, the last command in either branch determines the
final return status. If you have '&& return 0', the 0 is always
redundant. But in this case, no return statement at all should be needed.
Also, Bart suggested:
> compadd "$@" -M 'L:|zle-=' -a hooktypes
That L: form makes the zle- a sort of optional prefix. Is that what
you intended? Unfortunately it doesn't work together with -M 'r:|-=*
r:|=*' and zl<tab> won't complete. 'B:zle-=' is a shorter version
of the same thing. It might be better to do:
compadd "$@" -a hooktypes || compadd "$@" -pzle- -a hooktypes
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author