{"thread":{"id":"4321","subject":"[PATCH] Classify commands in stg --help output.","startedAt":"2006-05-28T21:25:19Z","lastAt":"2006-06-07T20:56:26Z","messageCount":2,"participants":["Yann Dirson","Catalin Marinas"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"20837","messageId":"20060528212519.3207.76228.stgit@gandelf.nowhere.earth","threadId":"4321","inReplyTo":null,"subject":"[PATCH] Classify commands in stg --help output.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2006-05-28T21:25:19Z","receivedAt":"2006-05-28T21:25:19Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"\nCommands will be much easier to find out that way.\nInspiration mostly comes from pg-help.\n\nSigned-off-by: Yann Dirson <ydirson@altern.org>\n---\n\n stgit/main.py |   74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---\n 1 files changed, 70 insertions(+), 4 deletions(-)\n\ndiff --git a/stgit/main.py b/stgit/main.py\nindex df4e1f5..83bffb4 100644\n--- a/stgit/main.py\n+++ b/stgit/main.py\n@@ -100,19 +100,85 @@ commands = {\n     'uncommit': stgit.commands.uncommit,\n     }\n \n+# classification: repository, stack, patch, working copy\n+repocommands = (\n+    'branch',\n+    'clone',\n+    'id'\n+    )\n+stackcommands = (\n+    'applied',\n+    'clean',\n+    'commit',\n+    'goto',\n+    'init',\n+    'pop',\n+    'pull',\n+    'push',\n+    'series',\n+    'top',\n+    'unapplied',\n+    'uncommit'\n+    )\n+patchcommands = (\n+    'delete',\n+    'export',\n+    'files',\n+    'fold',\n+    'import',\n+    'mail',\n+    'new',\n+    'pick',\n+    'refresh',\n+    'rename',\n+    'show'\n+    )\n+wccommands = (\n+    'add',\n+    'diff',\n+    'patches',\n+    'resolved',\n+    'rm',\n+    'status'\n+    )\n+\n+def _print_helpstring(cmd):\n+    print '  ' + cmd + ' ' * (12 - len(cmd)) + commands[cmd].help\n+    \n def print_help():\n     print 'usage: %s <command> [options]' % os.path.basename(sys.argv[0])\n     print\n-    print 'commands:'\n+    print 'Generic commands:'\n     print '  help        print the detailed command usage'\n     print '  version     display version information'\n     print '  copyright   display copyright information'\n-    print\n-\n+    # unclassified commands if any\n     cmds = commands.keys()\n     cmds.sort()\n     for cmd in cmds:\n-        print '  ' + cmd + ' ' * (12 - len(cmd)) + commands[cmd].help\n+        if not cmd in repocommands and not cmd in stackcommands \\\n+               and not cmd in patchcommands and not cmd in wccommands:\n+            _print_helpstring(cmd)\n+    print\n+\n+    print 'Repository commands:'\n+    for cmd in repocommands:\n+        _print_helpstring(cmd)\n+    print\n+    \n+    print 'Stack commands:'\n+    for cmd in stackcommands:\n+        _print_helpstring(cmd)\n+    print\n+\n+    print 'Patch commands:'\n+    for cmd in patchcommands:\n+        _print_helpstring(cmd)\n+    print\n+\n+    print 'Working-copy commands:'\n+    for cmd in wccommands:\n+        _print_helpstring(cmd)\n \n #\n # The main function (command dispatcher)\n"},{"id":"21401","messageId":"b0943d9e0606071356i5099b323qaa176d22b04a2ef@mail.gmail.com","threadId":"4321","inReplyTo":"20060528212519.3207.76228.stgit@gandelf.nowhere.earth","subject":"Re: [PATCH] Classify commands in stg --help output.","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2006-06-07T20:56:26Z","receivedAt":"2006-06-07T20:56:26Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 28/05/06, Yann Dirson <ydirson@altern.org> wrote:\n>\n> Commands will be much easier to find out that way.\n> Inspiration mostly comes from pg-help.\n\nApplied, with a small difference - I moved 'pull' to the repository\ncommands (it looks better there since it is not directly related to\nthe stack).\n\nThanks.\n\n-- \nCatalin\n"}]}