rbtools commands improvements

Review Request #3726 — Created Jan. 6, 2013 and submitted

Information

RBTools
api

Reviewers

Has parent review request /r/3727

Add initial command help

'rbt help' can now be called to display a list of commands and usage
text. 'rbt help <command>' will output the help specific to a command
including the options it takes. Formatting and the  extensiveness of
help for each command will be improved in the future, but this is a
good start.

Add checking for number of command args

The number of args provided to the command is now checked against the
number the command accepts (based on the signature of its main
method). Usage text and an error are now displayed if the number of
arguments provided is invalid.

Add proper usage text to commands

Commands may now define 'args' which will be output with usage text to
show the arguments a command takes. Commands now have a 'usage' method
which will return the usage text. While this can be overridden, the
base class 'usage' should generally suffice.

Introduce a new class for defining options

A new 'Option' has been added which allows specifying a 'config_key'.
The provided 'config_key' will be used to retrieve a default value for
the option from the configuration files. This will take precedence
over the value provided for 'default'. This should also allow us to
provide the corresponding config file option when displaying help.

Additionally, all of the current commands have been switched over to
the new method for defining options, and the parsing code has been
changed accordingly.

Add missing imports and fix small bug

A couple imports were missing, and a object attribute was being
accessed without "self." prepended.

Change command author to The Review Board Project

A number of the commands built as part of the core rbtools were using
individual authors. In order to be clear these commands are developed
as part of the core project, the author has been changed.
Ran commands. Output help for commands. Checked commands with invalid number of arguments.
Description From Last Updated

Col: 13 E125 continuation line does not distinguish itself from next logical line

reviewbotreviewbot

Col: 23 E127 continuation line over-indented for visual indent

reviewbotreviewbot

Col: 13 E125 continuation line does not distinguish itself from next logical line

reviewbotreviewbot

Blank line between these.

chipx86chipx86

"Review Board server". Should be fixed in other options across all files as well.

chipx86chipx86

There's a faster one called cStringIO. Generally, you want to do: try: from cStringIO import StringIO except ImportError: from StringIO …

chipx86chipx86

Should still go above, after the "from optparse", since it's a built-in Python module. Elsewhere, we do have a blank …

chipx86chipx86

Blank line before this.

chipx86chipx86
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        rbtools/commands/main.py
        rbtools/commands/__init__.py
        rbtools/commands/diff.py
        rbtools/commands/patch.py
        rbtools/commands/post.py
        rbtools/commands/attach.py
        rbtools/commands/publish.py
        setup.py
        rbtools/commands/close.py
      Ignored Files:
        rbtools/api/serverinterface.py
        rbtools/api/settings.py
        rbtools/commands/rbinfo.py
        rbtools/commands/rbinfov2.py
        rbtools/knownissues.txt
        rbtools/commands/rbattach.py
        rbtools/commands/rbupload.py
        rbtools/commands/rb.py
        rbtools/commands/utils.py
        rbtools/commands/tests.py
        rbtools/commands/rbdiff.py
        rbtools/commands/rbcreate.py
        rbtools/commands/rbconfig.py
        rbtools/commands/rbpatch.py
        AUTHORS
        rbtools/commands/rbpublish.py
        rbtools/commands/resource-browser.py
        rbtools/commands/rbopen.py
        rbtools/commands/rbclose.py
        rbtools/commands/rbpost.py
    
    
  2. rbtools/commands/post.py (Diff revision 1)
     
     
    Show all issues
    Col: 13
     E125 continuation line does not distinguish itself from next logical line
    
  3. rbtools/commands/post.py (Diff revision 1)
     
     
    Show all issues
    Col: 23
     E127 continuation line over-indented for visual indent
    
  4. rbtools/commands/post.py (Diff revision 1)
     
     
    Show all issues
    Col: 13
     E125 continuation line does not distinguish itself from next logical line
    
  5. 
      
SM
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        rbtools/commands/main.py
        rbtools/commands/publish.py
        rbtools/commands/close.py
        rbtools/commands/patch.py
        rbtools/commands/post.py
        rbtools/commands/attach.py
        rbtools/commands/__init__.py
        rbtools/commands/diff.py
      Ignored Files:
    
    
  2. 
      
chipx86
  1. 
      
  2. rbtools/commands/__init__.py (Diff revision 2)
     
     
     
    Show all issues
    Blank line between these.
  3. rbtools/commands/attach.py (Diff revision 2)
     
     
     
     
     
     
     
     
     
     
     
     
     
    Food for thought for a future change. It'd be nice to have some generally standard options we can include, like these.
  4. rbtools/commands/attach.py (Diff revision 2)
     
     
    Show all issues
    "Review Board server".
    
    Should be fixed in other options across all files as well.
  5. rbtools/commands/main.py (Diff revision 2)
     
     
    Show all issues
    There's a faster one called cStringIO. Generally, you want to do:
    
    try:
        from cStringIO import StringIO
    except ImportError:
        from StringIO import StringIO
  6. rbtools/commands/main.py (Diff revision 2)
     
     
    Show all issues
    Blank line before this.
  7. 
      
SM
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        rbtools/commands/main.py
        rbtools/commands/__init__.py
        rbtools/commands/diff.py
        rbtools/commands/patch.py
        rbtools/commands/post.py
        rbtools/commands/attach.py
        rbtools/commands/publish.py
        rbtools/commands/close.py
      Ignored Files:
    
    
  2. 
      
chipx86
  1. 
      
  2. rbtools/commands/main.py (Diff revisions 2 - 3)
     
     
     
     
     
    Show all issues
    Should still go above, after the "from optparse", since it's a built-in Python module.
    
    Elsewhere, we do have a blank line between the try/excepts and other imports. Sort of removes the 3 groups thing, but it's close enough.
  3. 
      
SM
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        rbtools/commands/main.py
        rbtools/commands/__init__.py
        rbtools/commands/diff.py
        rbtools/commands/patch.py
        rbtools/commands/post.py
        rbtools/commands/attach.py
        rbtools/commands/publish.py
        rbtools/commands/close.py
      Ignored Files:
    
    
  2. 
      
chipx86
  1. Ship It!
  2. 
      
SM
Review request changed

Status: Closed (submitted)

Change Summary:

Merged into api (2b12805a6b392e85f4a6e21424e0628736c1b405).
Loading...