{"thread":{"id":"5998","subject":"[PATCH 3/3] Disregard extraneous arguments when providing help","startedAt":"2006-10-22T13:02:14Z","lastAt":"2006-10-22T13:05:31Z","messageCount":4,"participants":["Karl Hasselström"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"29619","messageId":"20061022130214.16449.41482.stgit@localhost","threadId":"5998","inReplyTo":null,"subject":"[PATCH 0/3] Fix a few rough spots in StGIT's help command","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-10-22T13:02:14Z","receivedAt":"2006-10-22T13:02:14Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"This series fixes a few irritating things in StGIT's online help. I\npost them as three independent patches since these are somewhat\nsubjective improvements; feel free to drop the ones you don't like.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"29620","messageId":"20061022130520.16449.70729.stgit@localhost","threadId":"5998","inReplyTo":"20061022130214.16449.41482.stgit@localhost","subject":"[PATCH 1/3] Let \"stg help\" be like \"stg --help\"","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-10-22T13:05:21Z","receivedAt":"2006-10-22T13:05:21Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"From: Karl Hasselström <kha@treskal.com>\n\n\"stg --help\" prints the list of commands, but \"stg help\" just prints\nthe usage message for the help command. This may be useful in theory,\nbut the distinction is probably lost on 95% of all users (and the\nremaining 5% probably don't need to see the usage message for the help\ncommand anyway, since they know how it works). So just make both\ncommands output the helpful command list.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n---\n\n stgit/main.py |    3 +--\n 1 files changed, 1 insertions(+), 2 deletions(-)\n\ndiff --git a/stgit/main.py b/stgit/main.py\nindex de35ca8..66128a3 100644\n--- a/stgit/main.py\n+++ b/stgit/main.py\n@@ -226,8 +226,7 @@ def main():\n                                   option_list = command.options)\n             parser.print_help()\n         else:\n-            print 'usage: %s help <command>' % prog\n-\n+            print_help()\n         sys.exit(0)\n     if cmd in ['-v', '--version', 'version']:\n         print 'Stacked GIT %s' % version\n"},{"id":"29618","messageId":"20061022130526.16449.81113.stgit@localhost","threadId":"5998","inReplyTo":"20061022130214.16449.41482.stgit@localhost","subject":"[PATCH 2/3] When no command was given, print usage message","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-10-22T13:05:26Z","receivedAt":"2006-10-22T13:05:26Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"From: Karl Hasselström <kha@treskal.com>\n\nIt's just silly to say \"Unknown command\" when the user didn't give a\ncommand. Better to tell her to use a command.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n---\n\n stgit/main.py |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/stgit/main.py b/stgit/main.py\nindex 66128a3..02d1eb1 100644\n--- a/stgit/main.py\n+++ b/stgit/main.py\n@@ -198,7 +198,7 @@ def main():\n     prog = os.path.basename(sys.argv[0])\n \n     if len(sys.argv) < 2:\n-        print >> sys.stderr, 'Unknown command'\n+        print >> sys.stderr, 'usage: %s <command>' % prog\n         print >> sys.stderr, \\\n               '  Try \"%s --help\" for a list of supported commands' % prog\n         sys.exit(1)\n"},{"id":"29617","messageId":"20061022130531.16449.50598.stgit@localhost","threadId":"5998","inReplyTo":"20061022130214.16449.41482.stgit@localhost","subject":"[PATCH 3/3] Disregard extraneous arguments when providing help","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-10-22T13:05:31Z","receivedAt":"2006-10-22T13:05:31Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"From: Karl Hasselström <kha@treskal.com>\n\n\"stg --help pop\" prints the help text for pop, but \"stg --help pop\nfoo\" just prints the list of commands. That's silly, so fix it by\nsimply ignoring the extra arguments.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n---\n\n stgit/main.py |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/stgit/main.py b/stgit/main.py\nindex 02d1eb1..9fa0afc 100644\n--- a/stgit/main.py\n+++ b/stgit/main.py\n@@ -206,7 +206,7 @@ def main():\n     cmd = sys.argv[1]\n \n     if cmd in ['-h', '--help']:\n-        if len(sys.argv) == 3 and sys.argv[2] in commands:\n+        if len(sys.argv) >= 3 and sys.argv[2] in commands:\n             cmd = sys.argv[2]\n             sys.argv[2] = '--help'\n         else:\n"}]}