2998: Fix broken 'rbt -h' and 'rbt --help'. (rbt usage help is not helpful enough).

sudhir.********@gmai***** (Google Code) (Is this you? Claim this profile.)
smacleod
Aug. 6, 2013
What version are you running?
RBTools 0.5.1

What's the URL of the page containing the problem?
rbt tool usage help is not helpful enough. 'rbt -h' and 'rbt --help' is broken. 


What steps will reproduce the problem?
$ rbt -h
Usage: rbt [--version] <command> [options] [<args>]

rbt: error: no such option: -h



$ rbt --help
Usage: rbt [--version] <command> [options] [<args>]

rbt: error: no such option: --help


What is the expected output? What do you see instead?

Expected/suggested output is as below. (I am fine as long as options '-h' and '--help' is fixed. Don't have to below output)
sudhirbs@rhel-sudhirbs ~ $ rbt -h
Usage: rbt [--version] <command> [options] [<args>]

Options:
  --version   show program's version number and exit
  -h, --help  Run 'rbt help'


These are standard options which anyone would in Python/Linux/Gnu tools community would expect it to work. If this is not fixed, users may not be able to get help for rbt tool at all. 


What operating system are you using? What browser?
Windows and Linux. 

Please provide any additional information below.
Below code fix (may not be the best fix) will fix 'rbt -h' and 'rbt --help'


sudhirbs@rhel-sudhirbs  $ svn diff
Index: commands/main.py
===================================================================
--- commands/main.py    (revision 405567)
+++ commands/main.py    (working copy)
@@ -67,9 +67,15 @@
                           option_list=GLOBAL_OPTIONS,
                           add_help_option=False,
                           version='RBTools %s' % get_version_string())
+    parser.add_option('-h', '--help', dest='help', action='store_true',
+                      help = "Run 'rbt help'")
     parser.disable_interspersed_args()
     opt, args = parser.parse_args()

+    if opt.help:
+        parser.print_help()
+        sys.exit()
+
     if not args:
         help([], parser)
#1 smacleod
Patch at http://reviews.reviewboard.org/r/4228/
  • +PendingReview
  • +smacleod
david
#2 david
This has been committed.
  • -PendingReview
    +Fixed