Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 4/4] completion: _git: diff: add --no-index
- X-seq: zsh-workers 38147
- From: m0viefreak <m0viefreak.cm@xxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 4/4] completion: _git: diff: add --no-index
- Date: Sun, 13 Mar 2016 23:02:00 +0100
- Cc: m0viefreak <m0viefreak.cm@xxxxxxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=A7c1hU91SgAo6kzuF14hc2Bi/QLE8RwH5Ir+u+mjZd8=; b=u4JOykqmsNFqu7zoIe2HTxhBiBIi86mKoh8QubZuneFCHod05fEeQlTV+eNCo08Mp6 bkQSfW+sdPf5Y9BXFUFQ44dN9R/jgJeWU1sJEerHWf8rrBu7dYFdx9pOVUQIPIt7zbs2 6trDTWYzo9SESKJrwjD/Uo/5isV5WRWMaAgMVRlpeX0siRPyHeZWkp4SxR2uVvAJQFxM KYgcujeqBwEKFqvMcA8uvfoM0NnmdZwEHhTvpXcPI9hfgLHXBF6fk1uTSdfGSKYL0pnq R5P5//Hvmr3AHSW0A5+VsnpmTUy95WLAkCZkoXIfV3dMJA3S4sM+x/aBPSw/3oeY1D1y 78TQ==
- In-reply-to: <1457906520-2612-1-git-send-email-m0viefreak.cm@googlemail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1457906520-2612-1-git-send-email-m0viefreak.cm@googlemail.com>
---
Completion/Unix/Command/_git | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 023740e..c989a2c 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -725,12 +725,28 @@ _git-diff () {
$* \
$diff_options \
$diff_stage_options \
- '(--cached --staged)'{--cached,--staged}'[show diff between index and named commit]' \
+ '(--no-index --cached --staged)--no-index[diff files outside of git repo]' \
+ '(--no-index --cached --staged)'{--cached,--staged}'[show diff between index and named commit]' \
'(-)--[start file arguments]' \
'*:: :->from-to-file' && ret=0
case $state in
(from-to-file)
+ # If "--no-index" was given simply complete arbitrary files
+ if (( opt_args[(I)--no-index] )); then
+ local expl descr
+ if (( CURRENT == 1 )); then
+ descr="original file"
+ elif (( CURRENT == 2 )); then
+ descr="new file"
+ else
+ return ret
+ fi
+ _description all-files expl "$descr"
+ _files "$expl[@]"
+ return
+ fi
+
# If "--" is part of $opt_args, this means it was specified before any
# $words arguments. This means that no heads are specified in front, so
# we need to complete *changed* files only.
--
2.5.0.234.gefc8a62
Messages sorted by:
Reverse Date,
Date,
Thread,
Author