From 7d0eb62ccc2f2560cd1c4fea667ebee58fa2008c Mon Sep 17 00:00:00 2001 Message-Id: <7d0eb62ccc2f2560cd1c4fea667ebee58fa2008c.1716295032.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sat, 13 Jul 2013 16:34:40 +0100 Subject: [PATCH] subcommand.py: Have `subcommand' pass unknown arguments to constructor. Organization: Straylight/Edgeware From: Mark Wooding Since it has an explicit class parameter, it should be able to pass initargs to the class constructor. --- subcommand.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 -------------------------------------------------- -- [mdw]