git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [StGit PATCH 1/2] Modify bash completion to support help, version, and copyright.
@ 2009-01-20  0:46 ted
  2009-01-20  0:46 ` [StGit PATCH 2/2] Make bash completion fail to bashdefault before default completion ted
  0 siblings, 1 reply; 7+ messages in thread
From: ted @ 2009-01-20  0:46 UTC (permalink / raw)
  To: catalin.marinas; +Cc: git, Ted Pavlic

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-01-23  1:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).