mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-02 22:11:54 +02:00
34468: completion: git: stash: handle 'save' being the default
"git stash" should complete arguments for "git stash save", but without the message part.
This commit is contained in:
parent
8f403ab25c
commit
7d15b9a9cb
2 changed files with 14 additions and 5 deletions
|
@ -9,6 +9,9 @@
|
|||
* 34467: Completion/Unix/Command/_git: completion: git: minor doc
|
||||
fixes
|
||||
|
||||
* 34468: Completion/Unix/Command/_git: completion: git: stash:
|
||||
handle 'save' being the default
|
||||
|
||||
2015-02-07 Daniel Shahaf <d.s@daniel.shahaf.name>
|
||||
|
||||
* 34464: Completion/Unix/Command/_mtr: Update mtr completion
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue