From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21386 invoked by alias); 8 Feb 2015 14:18:05 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 34468 Received: (qmail 13769 invoked from network); 8 Feb 2015 14:18:04 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thequod.de; h= x-mailer:message-id:date:date:subject:subject:from:from:received :received:received; s=postfix2; t=1423405082; bh=wPTFOzR8if+IEaU 2GunMi59mutP1a5BcYiE3iiyHIHo=; b=OvYCVsSMlMQfLMIeTK2ia5RFtSpOdJ3 872VFxuv7wBE8HYYnTPiyyp1KXu35tZOx41scGzTEQiLvp1cVl5XHlRddQd4IQ+g X+7XkYeJNjVzyHExbZULPA1oHHMqk4lYrnu+RRixJD0Wgv2yOZ5wEJ4x4DUaBi6h Of5mYt19tD2s= From: Daniel Hahler To: zsh-workers@zsh.org Subject: [PATCH] completion: git: stash: handle 'save' being the default Date: Sun, 8 Feb 2015 15:17:58 +0100 Message-Id: <1423405078-21484-1-git-send-email-genml+zsh-workers@thequod.de> X-Mailer: git-send-email 2.3.0.dirty From: Daniel Hahler "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