Bug 853225 - Fix the mach usage line for subcommands [r=gps]
authorMatt Brubeck <mbrubeck@mozilla.com>
Wed, 20 Mar 2013 17:53:34 -0700
changeset 136105 176b8aa6844d2e49abcb88e11de785a080ffc5b5
parent 136104 65bbddd22ef087f1ddd9749dbe940edd493f9bfe
child 136106 df7a8ab4ffed956ffa5170ae7a5275595dc0272a
push id2452
push userlsblakk@mozilla.com
push dateMon, 13 May 2013 16:59:38 +0000
treeherdermozilla-beta@d4b152d29d8d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs853225
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 853225 - Fix the mach usage line for subcommands [r=gps] DONTBUILD (not part of the build)
python/mach/mach/main.py
--- a/python/mach/mach/main.py
+++ b/python/mach/mach/main.py
@@ -247,16 +247,18 @@ To see more help for a specific command,
             parser.usage = Mach.USAGE
             parser.print_usage()
             return 0
 
         args = parser.parse_args(argv)
 
         if args.command == 'help':
             if args.subcommand is None:
+                parser.usage = \
+                    '%(prog)s [global arguments] command [command arguments]'
                 parser.print_help()
                 return 0
 
             # ArgumentParser doesn't seem to have a public API to expose the
             # subparsers. So, we just simulate the behavior that causes
             # ArgumentParser to do the printing for us.
             return self._run([args.subcommand, '--help'])
 
@@ -413,17 +415,17 @@ To see more help for a specific command,
         self.settings.load_file(p)
 
         return os.path.exists(p)
 
     def get_argument_parser(self):
         """Returns an argument parser for the command-line interface."""
 
         parser = ArgumentParser(add_help=False,
-            usage='%(prog)s [global arguments] command [command arguments]')
+            usage='%(prog)s [global arguments]')
 
         # Order is important here as it dictates the order the auto-generated
         # help messages are printed.
         subparser = parser.add_subparsers(dest='command', title='Commands')
         parser.set_defaults(command='help')
 
         global_group = parser.add_argument_group('Global Arguments')