Disregard extraneous arguments when providing help
authorKarl Hasselström <kha@treskal.com>
Wed, 25 Oct 2006 19:24:54 +0000 (20:24 +0100)
committerCatalin Marinas <catalin.marinas@gmail.com>
Wed, 25 Oct 2006 19:24:54 +0000 (20:24 +0100)
"stg --help pop" prints the help text for pop, but "stg --help pop
foo" just prints the list of commands. That's silly, so fix it by
simply ignoring the extra arguments.

Signed-off-by: Karl Hasselström <kha@treskal.com>
stgit/main.py

index ea65288..183f9d7 100644 (file)
@@ -203,7 +203,7 @@ def main():
     cmd = sys.argv[1]
 
     if cmd in ['-h', '--help']:
-        if len(sys.argv) == 3 and sys.argv[2] in commands:
+        if len(sys.argv) >= 3 and sys.argv[2] in commands:
             cmd = sys.argv[2]
             sys.argv[2] = '--help'
         else: