From 3d65b8ddb999a5fc14cd1791282509adbc8cb03d Mon Sep 17 00:00:00 2001 From: Tal Wrii Date: Tue, 9 Feb 2016 23:28:08 +0000 Subject: [PATCH] --not-status flag I commonly want to see anything apart from unconfirmed or resolved bugs. This is useful this. I have also (somewhat contentiously) allowed a search without any keyword specified. This is useful for getting all bugz for a particularly product or component. I don't know if we want to insist that *some* constraint is applied: If people want to list all bugz they should be probably be free to do so... --- bugz/cli.py | 6 +++--- bugz/cli_argparser.py | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bugz/cli.py b/bugz/cli.py index 6cfe8d3..48a2bc3 100644 --- a/bugz/cli.py +++ b/bugz/cli.py @@ -653,9 +653,6 @@ def search(settings): if 'terms' in d: params['summary'] = d['terms'] - if not params: - raise BugzError('Please give search terms or options.') - log_info('Searching for bugs meeting the following criteria:') for key in params: log_info(' {0:<20} = {1}'.format(key, params[key])) @@ -665,6 +662,9 @@ def search(settings): result = settings.call_bz(settings.bz.Bug.search, params)['bugs'] + if hasattr(settings, 'not_status'): + result = list(b for b in result if b['status'] not in settings.not_status) + if not len(result): log_info('No bugs found.') else: diff --git a/bugz/cli_argparser.py b/bugz/cli_argparser.py index a3c3ad0..ac40877 100644 --- a/bugz/cli_argparser.py +++ b/bugz/cli_argparser.py @@ -294,6 +294,10 @@ def make_arg_parser(): action='append', help='restrict by status ' '(one or more, use all for all statuses)') + search_parser.add_argument('-S', '--not-status', + action='append', + help='exclude by status ' + '(one or more, use all for all statuses)') search_parser.add_argument('-v', '--version', action='append', help='restrict by version (one or more)')