git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Classify commands in stg --help output.
@ 2006-05-28 21:25 Yann Dirson
  2006-06-07 20:56 ` Catalin Marinas
  0 siblings, 1 reply; 2+ messages in thread
From: Yann Dirson @ 2006-05-28 21:25 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git


Commands will be much easier to find out that way.
Inspiration mostly comes from pg-help.

Signed-off-by: Yann Dirson <ydirson@altern.org>
---

 stgit/main.py |   74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 70 insertions(+), 4 deletions(-)

diff --git a/stgit/main.py b/stgit/main.py
index df4e1f5..83bffb4 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -100,19 +100,85 @@ commands = {
     'uncommit': stgit.commands.uncommit,
     }
 
+# classification: repository, stack, patch, working copy
+repocommands = (
+    'branch',
+    'clone',
+    'id'
+    )
+stackcommands = (
+    'applied',
+    'clean',
+    'commit',
+    'goto',
+    'init',
+    'pop',
+    'pull',
+    'push',
+    'series',
+    'top',
+    'unapplied',
+    'uncommit'
+    )
+patchcommands = (
+    'delete',
+    'export',
+    'files',
+    'fold',
+    'import',
+    'mail',
+    'new',
+    'pick',
+    'refresh',
+    'rename',
+    'show'
+    )
+wccommands = (
+    'add',
+    'diff',
+    'patches',
+    'resolved',
+    'rm',
+    'status'
+    )
+
+def _print_helpstring(cmd):
+    print '  ' + cmd + ' ' * (12 - len(cmd)) + commands[cmd].help
+    
 def print_help():
     print 'usage: %s <command> [options]' % os.path.basename(sys.argv[0])
     print
-    print 'commands:'
+    print 'Generic commands:'
     print '  help        print the detailed command usage'
     print '  version     display version information'
     print '  copyright   display copyright information'
-    print
-
+    # unclassified commands if any
     cmds = commands.keys()
     cmds.sort()
     for cmd in cmds:
-        print '  ' + cmd + ' ' * (12 - len(cmd)) + commands[cmd].help
+        if not cmd in repocommands and not cmd in stackcommands \
+               and not cmd in patchcommands and not cmd in wccommands:
+            _print_helpstring(cmd)
+    print
+
+    print 'Repository commands:'
+    for cmd in repocommands:
+        _print_helpstring(cmd)
+    print
+    
+    print 'Stack commands:'
+    for cmd in stackcommands:
+        _print_helpstring(cmd)
+    print
+
+    print 'Patch commands:'
+    for cmd in patchcommands:
+        _print_helpstring(cmd)
+    print
+
+    print 'Working-copy commands:'
+    for cmd in wccommands:
+        _print_helpstring(cmd)
 
 #
 # The main function (command dispatcher)

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

* Re: [PATCH] Classify commands in stg --help output.
  2006-05-28 21:25 [PATCH] Classify commands in stg --help output Yann Dirson
@ 2006-06-07 20:56 ` Catalin Marinas
  0 siblings, 0 replies; 2+ messages in thread
From: Catalin Marinas @ 2006-06-07 20:56 UTC (permalink / raw)
  To: Yann Dirson; +Cc: git

On 28/05/06, Yann Dirson <ydirson@altern.org> wrote:
>
> Commands will be much easier to find out that way.
> Inspiration mostly comes from pg-help.

Applied, with a small difference - I moved 'pull' to the repository
commands (it looks better there since it is not directly related to
the stack).

Thanks.

-- 
Catalin

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

end of thread, other threads:[~2006-06-07 20:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-28 21:25 [PATCH] Classify commands in stg --help output Yann Dirson
2006-06-07 20:56 ` Catalin Marinas

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