git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ted Pavlic <ted@tedpavlic.com>
To: catalin.marinas@gmail.com
Cc: git@vger.kernel.org, Ted Pavlic <ted@tedpavlic.com>
Subject: [StGit PATCH 2/2] Make bash completion fail to bashdefault before default completion.
Date: Thu, 22 Jan 2009 11:44:22 -0500	[thread overview]
Message-ID: <1232642662-12851-1-git-send-email-ted@tedpavlic.com> (raw)
In-Reply-To: <4978A0F1.9080703@tedpavlic.com>

If "-o bashdefault" isn't possible, use old "-o default" only.

(this patch inspired by similar mechanism in Mercurial bash completion
script)

Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
---

This patch corrects a bug in the previous one of the same name. In
particular, the second "complete" lacked the "||" in front of it needed
for proper operation. The first complete command should fail over to the
second if "bashdefault" isn't available.

 stgit/completion.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/stgit/completion.py b/stgit/completion.py
index b3fd282..38f0670 100644
--- a/stgit/completion.py
+++ b/stgit/completion.py
@@ -129,7 +129,8 @@ def main_switch(commands):
         'esac')
 
 def install():
-    return ['complete -o default -F _stg stg']
+    return ['complete -o bashdefault -o default -F _stg stg 2>/dev/null \\', [
+            '|| complete -o default -F _stg stg' ] ]
 
 def write_completion(f):
     commands = stgit.commands.get_commands(allow_cached = False)
-- 
1.6.1.213.g28da8

  reply	other threads:[~2009-01-22 16:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-20  0:46 [StGit PATCH 1/2] Modify bash completion to support help, version, and copyright ted
2009-01-20  0:46 ` [StGit PATCH 2/2] Make bash completion fail to bashdefault before default completion ted
2009-01-22 16:38   ` Ted Pavlic
2009-01-22 16:44     ` Ted Pavlic [this message]
2009-01-22 23:29   ` kha/{stable,safe,experimental} updated Karl Hasselström
2009-01-23  0:26     ` [kha/safe PATCH] completion bugfix: Place double pipes in front of alternate command Ted Pavlic
2009-01-23  1:35       ` Karl Hasselström

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=1232642662-12851-1-git-send-email-ted@tedpavlic.com \
    --to=ted@tedpavlic.com \
    --cc=catalin.marinas@gmail.com \
    --cc=git@vger.kernel.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.
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).