* [PATCH] completion: git: stash: handle 'save' being the default
@ 2015-02-08 14:17 Daniel Hahler
2015-02-08 18:53 ` Bart Schaefer
2015-02-08 19:29 ` Frank Terbeck
0 siblings, 2 replies; 3+ messages in thread
From: Daniel Hahler @ 2015-02-08 14:17 UTC (permalink / raw)
To: zsh-workers
From: Daniel Hahler <git@thequod.de>
"git stash" should complete arguments for "git stash save", but without
the message part.
---
Completion/Unix/Command/_git | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 50eb4d3..9552780 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1519,6 +1519,7 @@ _git-stash () {
case $state in
(command)
local -a commands
+ local -a save_arguments
commands=(
save:'save your local modifications to a new stash'
@@ -1531,19 +1532,24 @@ _git-stash () {
drop:'remove a single stashed state from the stash list'
create:'create a stash without storing it in the ref namespace')
+ save_arguments=(
+ '(--keep-index)--patch[interactively select hunks from diff between HEAD and working tree to stash]' \
+ '( --no-keep-index)--keep-index[all changes already added to the index are left intact]' \
+ '(--keep-index )--no-keep-index[all changes already added to the index are undone]' \
+ '(-q --quiet)'{-q,--quiet}'[suppress all output]' \
+ '(-u --include-untracked)'{-u,--include-untracked}'[include untracked files]' \
+ )
_describe -t commands command commands && ret=0
+ _arguments -S $save_arguments && ret=0 # "stash" defaults to "save", but without "message".
;;
(option-or-argument)
curcontext=${curcontext%:*}-$line[1]:
case $line[1] in
(save)
+ _arguments -S $save_arguments && ret=0
_arguments -S \
- '(--keep-index)--patch[interactively select hunks from diff between HEAD and working tree to stash]' \
- '( --no-keep-index)--keep-index[all changes already added to the index are left intact]' \
- '(--keep-index )--no-keep-index[all changes already added to the index are undone]' \
- '(-q --quiet)'{-q,--quiet}'[suppress all output]' \
- '(-u --include-untracked)'{-u,--include-untracked}'[include untracked files]' \
+ $save_arguments \
':: :_guard "([^-]?#|)" message' && ret=0
;;
(list)
--
2.3.0.dirty
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] completion: git: stash: handle 'save' being the default
2015-02-08 14:17 [PATCH] completion: git: stash: handle 'save' being the default Daniel Hahler
@ 2015-02-08 18:53 ` Bart Schaefer
2015-02-08 19:29 ` Frank Terbeck
1 sibling, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2015-02-08 18:53 UTC (permalink / raw)
To: zsh-workers
On Feb 8, 3:17pm, Daniel Hahler wrote:
}
} "git stash" should complete arguments for "git stash save", but without
} the message part.
Thank you; this had been bugging me.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] completion: git: stash: handle 'save' being the default
2015-02-08 14:17 [PATCH] completion: git: stash: handle 'save' being the default Daniel Hahler
2015-02-08 18:53 ` Bart Schaefer
@ 2015-02-08 19:29 ` Frank Terbeck
1 sibling, 0 replies; 3+ messages in thread
From: Frank Terbeck @ 2015-02-08 19:29 UTC (permalink / raw)
To: Daniel Hahler; +Cc: zsh-workers
Hi Daniel
Daniel Hahler wrote:
> […completion patches…]
I think all four of your patches are correct, so I just pushed them to
the central repo. Thanks!
Regards, Frank
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-02-08 19:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-08 14:17 [PATCH] completion: git: stash: handle 'save' being the default Daniel Hahler
2015-02-08 18:53 ` Bart Schaefer
2015-02-08 19:29 ` Frank Terbeck
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).