diff options
author | W. Trevor King <wking@drexel.edu> | 2009-06-24 17:41:56 -0400 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-06-24 17:41:56 -0400 |
commit | fdb2c3c3084a5c290e9fa89372e65e20918157bc (patch) | |
tree | 9773500469276f9fa7af174b916d21386df65964 | |
parent | 40859e85fc1690ad95a85e6adc7b7ef4e4157e49 (diff) | |
download | bugseverywhere-fdb2c3c3084a5c290e9fa89372e65e20918157bc.tar.gz |
`be target list` -> `be target --list` to standardize syntax.
And avoid confusion with bugs who's shorname is `list'? ;)
Now the usage info and help string also reflect the new method.
-rw-r--r-- | becommands/target.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/becommands/target.py b/becommands/target.py index f18b0c0..b2d1ffd 100644 --- a/becommands/target.py +++ b/becommands/target.py @@ -28,6 +28,8 @@ def execute(args, test=False): >>> execute(["a", "tomorrow"], test=True) >>> execute(["a"], test=True) tomorrow + >>> execute(["--list"], test=True) + tomorrow >>> execute(["a", "none"], test=True) >>> execute(["a"], test=True) No target assigned. @@ -38,9 +40,10 @@ def execute(args, test=False): bugid_args={0: lambda bug : bug.active==True}) if len(args) not in (1, 2): - raise cmdutil.UsageError + if not (options.list == True and len(args) == 0): + raise cmdutil.UsageError bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test) - if len(args) == 1 and args[0] == 'list': + if options.list: ts = set([bd.bug_from_uuid(bug).target for bug in bd.list_uuids()]) for target in sorted(ts): if target and isinstance(target,str): @@ -61,7 +64,9 @@ def execute(args, test=False): bd.save() def get_parser(): - parser = cmdutil.CmdOptionParser("be target BUG-ID [TARGET]") + parser = cmdutil.CmdOptionParser("be target BUG-ID [TARGET]\nor: be target --list") + parser.add_option("-l", "--list", action="store_true", dest="list", + help="List all available targets and exit") return parser longhelp=""" @@ -74,6 +79,11 @@ Targets are freeform; any text may be specified. They will generally be milestone names or release numbers. The value "none" can be used to unset the target. + +In the alternative `be target --list` form print a list of all +currently specified targets. Note that bug status +(i.e. opened/closed) is ignored. If you want to list all bugs +matching a current target, see `be list --target TARGET'. """ def help(): |