cmdln
cmdln copied to clipboard
Support for global options [moved]
This is Issue 10 moved from a Google Code project. Added by 2009-05-22T16:54:20.000Z by [email protected]. Please review that bug for more context and additional comments, but update this bug.
Original labels: Type-Enhancement, Priority-High, Usability
Original description
To add global options, one can write code like this:
def get_optparser(self):
p = cmdln.Cmdln.get_optparser(self)
p.add_option('-E', '--environment', dest='env',
help='path to virtualenv environment to use')
p.set_defaults(env=None)
return p
Wouldn't it be better to do this by using the same `@cmdln.option`
decorator but on the class itself rather than a method?
@cmdln.option('-E', '--environment', ...)
class Foo(cmdln.Cmdln):
...
Thoughts?
(this would affect issue 2)