git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[StGit PATCH 2/2] Make bash completion fail to bashdefault before default completion.

From
Ted Pavlic <ted@tedpavlic.com>
Date
Jan 22, 2009, 16:44 UTC
Message-ID
<1232642662-12851-1-git-send-email-ted@tedpavlic.com>
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
Previous: Ted PavlicNext: Karl Hasselström
Message 4 of 7 in “Modify bash completion to support help, version, and copyright.”
  1. 1/2 Modify bash completion to support help, version, and copyright.ted@tedpavlic.com, Jan 20, 2009
  2. 2/2 Make bash completion fail to bashdefault before default completion.ted@tedpavlic.com, Jan 20, 2009
  3. Ted PavlicJan 22, 2009
  4. 2/2 Make bash completion fail to bashdefault before default completion.Ted Pavlic, Jan 22, 2009
  5. kha/{stable,safe,experimental} updatedKarl Hasselström, Jan 22, 2009
  6. completion bugfix: Place double pipes in front of alternate command.Ted Pavlic, Jan 23, 2009
  7. Karl HasselströmJan 23, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.