From a3c468d89f3518417d3d23159a09d8877b5dad23 Mon Sep 17 00:00:00 2001 From: Bogdan Sulima Date: Wed, 16 Oct 2013 11:08:04 +0200 Subject: [PATCH 1/2] enable accumulating multiple arguments in a list, if default value is list 256 line restored --- commandr/commandr.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/commandr/commandr.py b/commandr/commandr.py index bd84ff2..8032507 100644 --- a/commandr/commandr.py +++ b/commandr/commandr.py @@ -389,6 +389,8 @@ def _BuildOptParse(self, argspec, defaults_dict): elif repr(defaults_dict[arg]) == 'True': self._AddOption(args, dest=arg, action='store_false', default=True) + elif isinstance(defaults_dict[arg], list): + self._AddOption(args, dest=arg, action='append', type='string') else: if isinstance(defaults_dict[arg], int): arg_type = 'int' From 88dcab08d9bb872ffe9da0937925aebdedeebd09 Mon Sep 17 00:00:00 2001 From: Bogdan Sulima Date: Wed, 16 Oct 2013 14:24:01 +0200 Subject: [PATCH 2/2] keep default list value --- commandr/commandr.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commandr/commandr.py b/commandr/commandr.py index 8032507..3fe95a5 100644 --- a/commandr/commandr.py +++ b/commandr/commandr.py @@ -390,7 +390,8 @@ def _BuildOptParse(self, argspec, defaults_dict): self._AddOption(args, dest=arg, action='store_false', default=True) elif isinstance(defaults_dict[arg], list): - self._AddOption(args, dest=arg, action='append', type='string') + self._AddOption(args, dest=arg, action='append', + type='string', default=defaults_dict[arg]) else: if isinstance(defaults_dict[arg], int): arg_type = 'int'