rbtools commands improvements
Review Request #3726 — Created Jan. 6, 2013 and submitted
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 |
reviewbot | |
Col: 23 E127 continuation line over-indented for visual indent |
reviewbot | |
Col: 13 E125 continuation line does not distinguish itself from next logical line |
reviewbot | |
Blank line between these. |
chipx86 | |
"Review Board server". Should be fixed in other options across all files as well. |
chipx86 | |
There's a faster one called cStringIO. Generally, you want to do: try: from cStringIO import StringIO except ImportError: from StringIO … |
chipx86 | |
Should still go above, after the "from optparse", since it's a built-in Python module. Elsewhere, we do have a blank … |
chipx86 | |
Blank line before this. |
chipx86 |
- Change Summary:
-
Removed the rename commits and moved them into a separate review request so only modifications are shown.
- Description:
-
~ This work is on top of John Sintal's work on several commands. Once
~ Has parent review request /r/3727
- This has been reviewed, both will be pushed together. 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. - - Use "rbt" instead of "rb" for base command.
- - The base command "rb" conflicted with another package, so to avoid
- problems we will now use "rbt" instead. I refactored things a bit to - make changing this name easier in the future. - - Add Steven MacLeod and John Sintal to AUTHORS
- - - - Remove unused files.
- - This removes a number of unused command and api files which have been
- sitting around. It's possible some of the logic present in the command - files could be useful in the future, but the implementation details - would need to be changed drastically.
-
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:
-
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:
-
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: