Added options -h/--help.
authorThomas Arendsen Hein <thomas@intevation.de>
Fri, 26 Aug 2005 08:37:41 +0200
changeset 1048 7fbb440b2e63
parent 1047 a0538ea1ac50
child 1049 160a68cd393f
Added options -h/--help.
mercurial/commands.py
tests/test-help.out
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1523,6 +1523,7 @@ globalopts = [
     ('', 'time', None, 'time how long the command takes'),
     ('', 'profile', None, 'profile'),
     ('', 'version', None, 'output version information and exit'),
+    ('h', 'help', None, 'display help and exit'),
 ]
 
 norepo = "clone init version help debugconfig debugdata" + \
@@ -1632,7 +1633,10 @@ def dispatch(args):
 
     try:
         try:
-            if options['version']:
+            if options['help']:
+                help_(u, cmd)
+                sys.exit(0)
+            elif options['version']:
                 show_version(u)
                 sys.exit(0)
             elif not cmd:
--- a/tests/test-help.out
+++ b/tests/test-help.out
@@ -112,7 +112,6 @@ list of commands (use "hg help -v" to sh
  update      update or merge working directory
  verify      verify the integrity of the repository
  version     output version and copyright information
-hg add: option -h not recognized
 hg add [OPTION]... [FILE]...
 
 add the specified files on the next commit