From: Frank Terbeck <ft@bewatermyfriend.org>
To: Luka Perkov <lists@lukaperkov.net>
Cc: zsh-workers@zsh.org
Subject: Re: PATCH: _quilt: fix push and pop completion
Date: Wed, 27 Jul 2011 09:50:19 +0200 [thread overview]
Message-ID: <87wrf46u2s.fsf@ft.bewatermyfriend.org> (raw)
In-Reply-To: <20110726225739.GA6008@w500.lan> (Luka Perkov's message of "Wed, 27 Jul 2011 00:57:39 +0200")
Luka Perkov wrote:
> Patch fixes 'bug' in _quilt completion script when there is not possible
> to do push or pop. Also tabs are replaced with spaces because they were
> not consistent.
This still doesn't quite work for me.
When I'm trying push or pop completion in a directory where there are no
quilt patches at all, the completion is still echoing back error
messages to me.
Also, your patch runs `quilt' twice, which is not needed.
How about checking for the return value of `quilt' after running the
{un,}applied sub-commands?
The following seems to work:
diff --git a/Completion/Unix/Command/_quilt b/Completion/Unix/Command/_quilt
index a2fd799..fd475ed 100644
--- a/Completion/Unix/Command/_quilt
+++ b/Completion/Unix/Command/_quilt
@@ -1,5 +1,8 @@
#compdef quilt
+local -a tmp
+local rc
+
_arguments \
'--trace' \
'--quiltrc:config file:_files' \
@@ -14,17 +17,29 @@ case "$state" in
case "$words[1]" in
(applied|delete|files|graph|header|next|previous|refresh|unapplied)
- _wanted -V 'patches' expl 'patch' compadd ${(f)"$(quilt series)"}
- ;;
+ _wanted -V 'patches' expl 'patch' compadd ${(f)"$(quilt series)"}
+ ;;
(push)
- _wanted -V 'unapplied patches' expl 'patch' compadd ${(f)"$(quilt unapplied)"}
- ;;
+ tmp=( ${(f)"$(quilt unapplied 2>&1)"} )
+ rc=$?
+ if (( rc == 0 )); then
+ _wanted -V 'unapplied patches' expl 'patch' compadd "${tmp[@]}"
+ else
+ _message "No unapplied patches"
+ fi
+ ;;
(pop)
- _wanted -V 'applied patches' expl 'patch' compadd ${(f)"$(quilt applied)"}
- ;;
+ tmp=( ${(f)"$(quilt applied 2>&1)"} )
+ rc=$?
+ if (( rc == 0 )); then
+ _wanted -V 'applied patches' expl 'patch' compadd "${tmp[@]}"
+ else
+ _message "No applied patches"
+ fi
+ ;;
(*)
- _files
- ;;
+ _files
+ ;;
esac
;;
esac
next prev parent reply other threads:[~2011-07-27 8:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-26 22:57 Luka Perkov
2011-07-27 7:50 ` Frank Terbeck [this message]
2011-07-27 18:21 ` Luka Perkov
2011-07-29 13:10 ` Frank Terbeck
2011-07-29 22:15 ` Luka Perkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wrf46u2s.fsf@ft.bewatermyfriend.org \
--to=ft@bewatermyfriend.org \
--cc=lists@lukaperkov.net \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).