From 940fa7a1805b0de7b1c296883bf962cc6f42f433 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 20 Mar 2011 13:35:48 -0400 Subject: [PATCH] args.grouped now returns Arg instance dict --- clint/arguments.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/clint/arguments.py b/clint/arguments.py index 3a40313..e0de990 100644 --- a/clint/arguments.py +++ b/clint/arguments.py @@ -189,25 +189,26 @@ class Args(object): except IndexError: return None + @property def grouped(self): """Extracts --flag groups from argument list. - Returns {format: [paths], ...} + Returns {format: Args, ...} """ - collection = OrderedDict(_=list()) + collection = OrderedDict(_=Args(no_argv=True)) _current_group = None for arg in self.all: if arg.startswith('-'): _current_group = arg - collection[arg] = [] + collection[arg] = Args(no_argv=True) else: if _current_group: - collection[_current_group].append(arg) + collection[_current_group]._args.append(arg) else: - collection['_'].append(arg) + collection['_']._args.append(arg) return collection