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)')