From: Mark Wooding Date: Sat, 13 Jul 2013 15:34:40 +0000 (+0100) Subject: subcommand.py: Have `subcommand' pass unknown arguments to constructor. X-Git-Tag: 1.0.3~2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/chopwood/commitdiff_plain/7d0eb62ccc2f2560cd1c4fea667ebee58fa2008c subcommand.py: Have `subcommand' pass unknown arguments to constructor. Since it has an explicit class parameter, it should be able to pass initargs to the class constructor. --- diff --git a/subcommand.py b/subcommand.py index b285915..d6d850e 100644 --- a/subcommand.py +++ b/subcommand.py @@ -392,12 +392,10 @@ class SubcommandOptionParser (OP.OptionParser, object): ## ready to roll. COMMANDS = [] -def subcommand(name, contexts, desc, cls = Subcommand, - opts = [], params = [], oparams = [], rparam = None): +def subcommand(name, contexts, desc, cls = Subcommand, *args, **kw): """Decorator for defining subcommands.""" def _(func): - COMMANDS.append(cls(name, contexts, desc, func, - opts, params, oparams, rparam)) + COMMANDS.append(cls(name, contexts, desc, func, *args, **kw)) return _ ###----- That's all, folks --------------------------------------------------