git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix a few rough spots in StGIT's help command
@ 2006-10-22 13:02 Karl Hasselström
  2006-10-22 13:05 ` [PATCH 1/3] Let "stg help" be like "stg --help" Karl Hasselström
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Karl Hasselström @ 2006-10-22 13:02 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

This series fixes a few irritating things in StGIT's online help. I
post them as three independent patches since these are somewhat
subjective improvements; feel free to drop the ones you don't like.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle

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

* [PATCH 1/3] Let "stg help" be like "stg --help"
  2006-10-22 13:02 [PATCH 0/3] Fix a few rough spots in StGIT's help command Karl Hasselström
@ 2006-10-22 13:05 ` Karl Hasselström
  2006-10-22 13:05 ` [PATCH 2/3] When no command was given, print usage message Karl Hasselström
  2006-10-22 13:05 ` [PATCH 3/3] Disregard extraneous arguments when providing help Karl Hasselström
  2 siblings, 0 replies; 4+ messages in thread
From: Karl Hasselström @ 2006-10-22 13:05 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

From: Karl Hasselström <kha@treskal.com>

"stg --help" prints the list of commands, but "stg help" just prints
the usage message for the help command. This may be useful in theory,
but the distinction is probably lost on 95% of all users (and the
remaining 5% probably don't need to see the usage message for the help
command anyway, since they know how it works). So just make both
commands output the helpful command list.

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

 stgit/main.py |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/stgit/main.py b/stgit/main.py
index de35ca8..66128a3 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -226,8 +226,7 @@ def main():
                                   option_list = command.options)
             parser.print_help()
         else:
-            print 'usage: %s help <command>' % prog
-
+            print_help()
         sys.exit(0)
     if cmd in ['-v', '--version', 'version']:
         print 'Stacked GIT %s' % version

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

* [PATCH 2/3] When no command was given, print usage message
  2006-10-22 13:02 [PATCH 0/3] Fix a few rough spots in StGIT's help command Karl Hasselström
  2006-10-22 13:05 ` [PATCH 1/3] Let "stg help" be like "stg --help" Karl Hasselström
@ 2006-10-22 13:05 ` Karl Hasselström
  2006-10-22 13:05 ` [PATCH 3/3] Disregard extraneous arguments when providing help Karl Hasselström
  2 siblings, 0 replies; 4+ messages in thread
From: Karl Hasselström @ 2006-10-22 13:05 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

From: Karl Hasselström <kha@treskal.com>

It's just silly to say "Unknown command" when the user didn't give a
command. Better to tell her to use a command.

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

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

diff --git a/stgit/main.py b/stgit/main.py
index 66128a3..02d1eb1 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -198,7 +198,7 @@ def main():
     prog = os.path.basename(sys.argv[0])
 
     if len(sys.argv) < 2:
-        print >> sys.stderr, 'Unknown command'
+        print >> sys.stderr, 'usage: %s <command>' % prog
         print >> sys.stderr, \
               '  Try "%s --help" for a list of supported commands' % prog
         sys.exit(1)

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

* [PATCH 3/3] Disregard extraneous arguments when providing help
  2006-10-22 13:02 [PATCH 0/3] Fix a few rough spots in StGIT's help command Karl Hasselström
  2006-10-22 13:05 ` [PATCH 1/3] Let "stg help" be like "stg --help" Karl Hasselström
  2006-10-22 13:05 ` [PATCH 2/3] When no command was given, print usage message Karl Hasselström
@ 2006-10-22 13:05 ` Karl Hasselström
  2 siblings, 0 replies; 4+ messages in thread
From: Karl Hasselström @ 2006-10-22 13:05 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: git

From: Karl Hasselström <kha@treskal.com>

"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 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/stgit/main.py b/stgit/main.py
index 02d1eb1..9fa0afc 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -206,7 +206,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:

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

end of thread, other threads:[~2006-10-22 13:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-22 13:02 [PATCH 0/3] Fix a few rough spots in StGIT's help command Karl Hasselström
2006-10-22 13:05 ` [PATCH 1/3] Let "stg help" be like "stg --help" Karl Hasselström
2006-10-22 13:05 ` [PATCH 2/3] When no command was given, print usage message Karl Hasselström
2006-10-22 13:05 ` [PATCH 3/3] Disregard extraneous arguments when providing help 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).