Zsh Mailing List Archive
Messages sorted by:
Re: Setup git-stash completion for a function: $line is wrong
- X-seq: zsh-users 22580
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Setup git-stash completion for a function: $line is wrong
- Date: Thu, 16 Mar 2017 14:02:24 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=QMkobu7Zlm3ZVcRwRZjOx8riGwrWkT0O93/hSJzfhAg=; b=PG+32Y2gQ1advkGJCrgFPSPUmvjmpN9vYcn9uPrTd6JB7xH0kMjacuosqSZsAj5FrC bmAdff8s5JToSf//bNHjAraa4WeTXqat08Lbn3g/lnObn+bQy5cfrWe28C0BsfHA+Kyk zJmD3o/SXS6LDar1FFfEI71JBkfDYmRRzxIQbx/W4/78G3PxcsY0asdzP2CmBuLsnBOB fudd3KC+mjcvgjXLapafdA0CdaOe0odRaXwklDejh5qHPThL+Nl6UpB6n04+dgGxBwaF 6UdHGN9ZJQ2sJM2WoeVJnre4IaO6PfMtrClCaxr5MabrKC1n05nfhi4yVhN1yt19i/hf TGdg==
- In-reply-to: <email@example.com>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:email@example.com>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <firstname.lastname@example.org> <170312152742.ZM16252@torch.brasslantern.com> <email@example.com>
On Mar 15, 12:59am, Daniel Hahler wrote:
} It did not work initially, but luckily it seems to be just an off-by-one
} error when incrementing CURRENT.
Indeed, sorry about that. words is being replaced by $@ rather than
appended-to, so you have to take one away from the increment.
} > There's already (compdef cmd=service) e.g.
} > compdef gsta=git
} Yes, I am aware of that, and what I mean is more or less something in this
} regard, e.g. by making it handle command+arguments.
For other readers of this thread: Any input here on whether this is
actually a common use case?
} maybe a list could be used:
} compdef gsta=(git stash)
That would require that 'compdef' be made a keyword, otherwise that's a
syntax error. I don't think we're likely to embed compsys that deeply
into the shell syntax.
We could maybe do what some other compsys functions do:
compdef gsta='(git stash)'
Not sure what that would require of the lower-level code where the value
of the compdef is evaluated.
Probably the right way to approach this is to have a completer "_wrapper"
which looks up the replacement command via zstyle, fixes up $words etc.,
and then calls _complete. The potentially tricky part is preventing the
replacement from changing the context, i.e. adding syntactic tokens
like globbing or pipes, or at least failing gracefully in that event.
} I am using it with the following to automatically update a ctags tags file
This sounds more like a job for a git hook ... except there isn't one
Messages sorted by: