aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Harder <radhermit@gmail.com>2015-12-04 03:12:02 -0500
committerTim Harder <radhermit@gmail.com>2015-12-06 02:22:11 -0500
commit53081bf27c6c7abaad26af90601b04ee4e847429 (patch)
tree9ea6bc8e46d6e66f775bcb7bfc4dc02eac2a465f
parentpkeyword: initial implementation of ekeyword workalike (diff)
downloadpkgcore-pkeyword.tar.gz
pkgcore-pkeyword.tar.bz2
pkgcore-pkeyword.zip
pkeyword: allow set argumentspkeyword
-rw-r--r--pkgcore/scripts/pkeyword.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/pkgcore/scripts/pkeyword.py b/pkgcore/scripts/pkeyword.py
index 98ebbc7cc..5e527d8e1 100644
--- a/pkgcore/scripts/pkeyword.py
+++ b/pkgcore/scripts/pkeyword.py
@@ -12,13 +12,21 @@ from pkgcore.repository.util import RepositoryGroup
class StoreTarget(argparse._AppendAction):
def __call__(self, parser, namespace, values, option_string=None):
- targets = []
- try:
- for x in values:
- targets.append((x, parserestrict.parse_match(x)))
- except parserestrict.ParseError as e:
- parser.only_error(e)
- setattr(namespace, self.dest, targets)
+ namespace.sets = []
+ if isinstance(values, basestring):
+ values = [values]
+ for token in values:
+ if token.startswith('@'):
+ namespace.sets.append(token[1:])
+ else:
+ try:
+ argparse._AppendAction.__call__(
+ self, parser, namespace,
+ (token, parserestrict.parse_match(token)), option_string=option_string)
+ except parserestrict.ParseError as e:
+ parser.only_error(e)
+ if namespace.targets is None:
+ namespace.targets = []
argparser = commandline.mk_argparser(description=__doc__)