diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2015-02-19 22:01:11 +0100 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2015-02-26 22:37:56 +0100 |
commit | 3168633077dc297878ef72b7e4feaa0c365cb73c (patch) | |
tree | e9fd266de6d99266f2f51cd32722e41cd014c907 /ext-plugins | |
parent | 8ecf1bd8746ce6341f3856fad96a504fca6af869 (diff) | |
download | clufter-3168633077dc297878ef72b7e4feaa0c365cb73c.tar.gz clufter-3168633077dc297878ef72b7e4feaa0c365cb73c.tar.xz clufter-3168633077dc297878ef72b7e4feaa0c365cb73c.zip |
lib-general/formats/command: special "magic_split" flavor
... that allows specifying multi-argument option as a single-argument
one with '::' being a logical separator between such args. This is
needed, for instance, when multi-argument option is specified last to
differentiate between such option argument and proper command argument
(only a single argument for an option is normally expected).
Also add a respective unit test.
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'ext-plugins')
-rw-r--r-- | ext-plugins/lib-general/formats/command.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ext-plugins/lib-general/formats/command.py b/ext-plugins/lib-general/formats/command.py index 3774cba..04a49ad 100644 --- a/ext-plugins/lib-general/formats/command.py +++ b/ext-plugins/lib-general/formats/command.py @@ -42,6 +42,9 @@ class command(SimpleFormat): if acc: ret.append(tuple(acc)) acc = [] if i is None else [i] + elif self._dict.get('magic_split', False): + acc.extend(i.split('::')) # magic "::"-split + merged.append(None) else: acc.append(i) # expect that, by convention, option takes at most a single argument |