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

[StGit PATCH 1/2] Modify bash completion to support help, version, and copyright.

From
ted@tedpavlic.com <ted@tedpavlic.com>
Date
Jan 20, 2009, 00:46 UTC
Message-ID
<1232412373-10836-1-git-send-email-ted@tedpavlic.com>
From: Ted Pavlic <ted@tedpavlic.com>

"stg <tab>" lists all commands, including "help", "version", and "copyright".

"stg he<tab>" completes "stg help " "stg ver<tab>" completes "stg version " "stg copy<tab>" completes "stg copyright "

"stg help <tab>" lists all commands /other than/ help, version, and copyright.

"stg version <tab>" goes directly to shell completion. "stg copyright <tab>" goes directly to shell completion.

Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
---
 stgit/completion.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/stgit/completion.py b/stgit/completion.py
index affc8c6..b3fd282 100644
--- a/stgit/completion.py
+++ b/stgit/completion.py
@@ -111,13 +111,19 @@ def main_switch(commands):
         ('# Complete name of subcommand if the user has not finished'
          ' typing it yet.'),
         'if test $c -eq $COMP_CWORD -a -z "$command"; then', [
-            ('COMPREPLY=($(compgen -W "$_stg_commands" --'
+            ('COMPREPLY=($(compgen -W "help version copyright $_stg_commands" --'
              ' "${COMP_WORDS[COMP_CWORD]}"))'),
             'return'],
         'fi',
         '',
         '# Complete arguments to subcommands.',
         'case "$command" in', [
+            'help) ', [
+            ('COMPREPLY=($(compgen -W "$_stg_commands" --'
+             ' "${COMP_WORDS[COMP_CWORD]}"))'),
+            'return ;;'],
+            'version) return ;;',
+            'copyright) return ;;'], [
             '%s) _stg_%s ;;' % (cmd, cmd)
             for cmd in sorted(commands.iterkeys())],
         'esac')
-- 
1.6.1.87.g15624
Next: ted@tedpavlic.com
Message 1 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.