Branch: refs/heads/master
Home: https://github.com/openSUSE/osc2
Commit: 987c344770767deae296adb35b346c6530558881
https://github.com/openSUSE/osc2/commit/987c344770767deae296adb35b346c653055...
Author: Marcus Huewe
Date: 2012-08-16 (Thu, 16 Aug 2012)
Changed paths:
M osc/cli/description.py
Log Message:
-----------
- osc.cli.description: added support for "subcommand" options
That is it is possible to specify a set of options in command class
and all subcommands will have the options.
Example:
class Review(CommandDescription, OscCommand):
"""Show and modify reviews."""
args = 'review'
...
opt_user = Option('U', 'user', 'list only requests for USER', sub=True)
opt_group = Option('G', 'group', 'list only requests for GROUP', sub=True)
class ReviewFoo(CommandDescription, Review):
cmd = 'foo'
mutex_group = [Review.opt_user, Review.opt_group]
class ReviewBar(CommandDescription, Review):
cmd = 'bar'
So it is possible to specify the options once in the "base" class
instead of repeating them in each subcommand class.
Note: the options won't be added to the "review" command itself.