Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Completion batch #4: New UNIX functions
- X-seq: zsh-workers 42228
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] Completion batch #4: New UNIX functions
- Date: Fri, 05 Jan 2018 15:54:12 +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=1515164058; bh=LzbNnQNAffK+3W82hDdZfwvVVt3S0DWtb22fcYcxcJc=; h=From:References:To:Subject:Date:From:Subject; b=jHvANcp5dqRYoS+tlZEIQavORXlfwnmIl4jjjs+tnjISad+d8tTDzyTV4jYabGObPnQtWdBalOuGmb4kRK/DlRZL1rF0MbI0YD2+ZMe1/2CGsXABDm0A46dIW7WSmBIu4Hy5CRaHvhSLlDBJbCnA/5xATsXyMERWOjRf1Gt0jEL53s+xk8MAORhr+nAhmmXyFO3k4TOvHrZDT/PW7bQqXhLBChBZDWQmiOeweMzsT3PBT3MOh7YkfYF3kYCg/LowyYoQkW7t21Du6Muaufqp4hlprvlptWkIopNUn6V/N6tbLdGqBg2sjV2HVqZb9rl4nIoGr7a3Tt48WFkDMovBYA==
- In-reply-to: <0ED247D6-B6E3-40AB-A59D-DDEFC4083BEE@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: <0ED247D6-B6E3-40AB-A59D-DDEFC4083BEE@dana.is>
dana wrote:
> new functions belonging to the 'Unix' group. None of them are particularly
Actually, I think sublimetext belongs under X. X is supposed to cover
anything that needs a GUI so stuff like acroread, netscape, matlab etc
are there. I've also called it _sublimetext rather than _subl which is
how things are normally named.
> As always, let me know if you see anything i've done weird.
I've tweaked the other functions to remove superfluous local statements
and correct the return status in one case. _arguments' local
requirements are unfortunately somewhat confusing:
If you don't use states (:-> syntax) no extra variables need to be
declared local.
If you do, you need to declare context, state and line local. state and
context are arrays and you should loop over them calling, _wanted -C
"$context[1]" as appropriate.
However, in the vast majority of cases, it is only ever possible for
state and context to have one element in them. You need something like
optional arguments for multiple simultaneous states to be an issue. In
this case, as a simplification, you can call _arguments -C and instead
of using context, $curcontext is modified directly with the context for
the one state. For this to work, you need to preserve the existing
value, hence this usage:
local curcontext="$curcontext" state line
opt_args ought also to be declared local but we tend to be lax about
that.
state_descr is a relatively new addition and most functions predate it.
I tend not to bother.
With the return status, it is key to remember that if people unset the
prefix-needed style, _arguments is likely to add matches and return a
state so don't do: _arguments -options '*: :->state' && return
the common && ret=0 idiom works for this case along with an explicit
check that $state is set.
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author