about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2015-02-08 15:17:58 +0100
committerFrank Terbeck <ft@bewatermyfriend.org>2015-02-08 20:27:26 +0100
commit7d15b9a9cb22972b5864523de5689aa05a8d61da (patch)
treead28043eb69b1fbb8ca72e1f93a9ee9e2f5fd082 /Completion
parent8f403ab25c7c31e53e7e02f7c44c414913fb7def (diff)
downloadzsh-7d15b9a9cb22972b5864523de5689aa05a8d61da.tar.gz
zsh-7d15b9a9cb22972b5864523de5689aa05a8d61da.tar.xz
zsh-7d15b9a9cb22972b5864523de5689aa05a8d61da.zip
34468: completion: git: stash: handle 'save' being the default
"git stash" should complete arguments for "git stash save", but without
the message part.
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/_git16
1 files changed, 11 insertions, 5 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 50eb4d365..9552780c6 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)