Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Setup git-stash completion for a function: $line is wrong
- X-seq: zsh-users 22582
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Setup git-stash completion for a function: $line is wrong
- Date: Thu, 16 Mar 2017 23:54:04 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=ybKKTxlQ3U/z7rMy9HAzDBFSLtg=; b=ZttrunKsDHkHURebDOLx423s OiC5t8Zhd4H597ogrPLOfTc2Ck74LUXojB8UHcoLkncNt4vXX35yuSBEpBwlQHeP z59NCEenfZfXq0KXrd93mBJdtEzDolpZ+vnwKde5vJvLIeNEqiYT6X2zqHhJIMmS Q+z4yPf0GRHXcUozyRVdTehOwBN20RsFL+oCNXGsrvvz/MSj8jUltGJG3CnYZkJH WssnyIdVGw9zWNPlnMFz1drd0VFD8NU1QguIVu+NKdjOoqNsdvws5m6wCbBtk2o7 Nz11bt3uSmFNw+nGtRKOVpyeI9enOFxskUN7oMTZIIwPN64ESJQqHLmcQvo3qA==
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=ybKKTxlQ3U/z7rMy9HAzDBFSLtg=; b=XAtaYH0K+PZ26cEr2EN5MjTA DQG7TpxxMdXy1yobPPeRBvYedKvNqrnRk7nS8zqQzV+Ae8N/OW7FVGsvCxkwQefG zME6afv7DvhstW1KPi8iuIQOEJ9cjTj6Iz7tHZRU254DwKwUKinMxQrdaiYkFGwg PoT+jyNWgAv775BjM4f5Oj/dovYVQVHWIxsapAhe6z59ibC9U6dVINN5bKokjUjp uGe2pVL6opNvUeLIy+mmAlHSE74i7hUqTn0IihN6sOtXyVEmnRNQxoXht5aUhC/J sbB5wKEmKKWXD0frzjZlkyKE5UXHO4vlfoGZLjHNn1JSxoaoGlctuva5FU4sSA==
- In-reply-to: <170316140224.ZM17994@torch.brasslantern.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <5fe1f6a0-a0d1-9b21-310c-a3bb16aa7d18@thequod.de> <170312152742.ZM16252@torch.brasslantern.com> <6e020492-e5f4-eca7-c4d4-07dc4257a5ce@thequod.de> <170316140224.ZM17994@torch.brasslantern.com>
Bart Schaefer wrote on Thu, Mar 16, 2017 at 14:02:24 -0700:
> On Mar 15, 12:59am, Daniel Hahler wrote:
> } Bart Schaefer:
> } > 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?
As a datapoint: in my zshrc, I have 12 wrapper functions of the «foo()
{ command foo "$@" }» form, and only one function that would benefit
from the proposed compdef enhancement.
That function takes 'git rev-list' arguments and runs 'tig' (a Git
history viewer, like gitk) on them:
.
mytig() {
if (( $# )); then
tig --no-walk $(git log --pretty=%H "$@")
else
tig --date-order --all -150
fi
}
Writing a completion function for this helper today is a little tricky,
since 'autoload +X _git' doesn't define _git-log(). Under the proposal,
defining completion for this helper would simply be «compdef mytig='git
log --pretty=%H'». (Or whatever syntax is decided on)
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author