From e1e62e4dfb92a5f6dae947838559d37996256911 Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Jul 01 2020 21:16:37 +0000 Subject: [PATCH 1/2] cli: add --task and --source options to list-builds command Fixes https://pagure.io/koji/issue/2356 The api already accepted these parameters. This just provides access to use them via the command line. --- diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py index 06c4b69..7b874c8 100644 --- a/cli/koji_cli/commands.py +++ b/cli/koji_cli/commands.py @@ -3010,8 +3010,10 @@ def anon_handle_list_builds(goptions, session, args): parser.add_option("--after", help=_("List builds built after this time (same format as for --before")) parser.add_option("--state", help=_("List builds in this state")) + parser.add_option("--task", help=_("List builds for this task")) parser.add_option("--type", help=_("List builds of this type.")) - parser.add_option("--prefix", help=_("Only list packages starting with this prefix")) + parser.add_option("--prefix", help=_("Only builds starting with this prefix")) + parser.add_option("--source", help=_("Only builds where the source field matches (glob pattern)")) parser.add_option("--owner", help=_("List builds built by this owner")) parser.add_option("--volume", help=_("List builds by volume ID")) parser.add_option("-k", "--sort-key", action="append", metavar='FIELD', @@ -3088,6 +3090,13 @@ def anon_handle_list_builds(goptions, session, args): opts['completeBefore'] = getattr(options, 'before') if options.after: opts['completeAfter'] = getattr(options, 'after') + if options.task: + try: + opts['taskID'] = int(options.task) + except ValueError: + parser.error(_("Task id must be an integer")) + if options.source: + opts['source'] = options.source if options.buildid: try: buildid = int(options.buildid) From 5a377041bc1e870a31a59c918867aa31400cf037 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Aug 25 2020 13:03:01 +0000 Subject: [PATCH 2/2] fix flake8 --- diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py index 7b874c8..a1e219c 100644 --- a/cli/koji_cli/commands.py +++ b/cli/koji_cli/commands.py @@ -3013,7 +3013,8 @@ def anon_handle_list_builds(goptions, session, args): parser.add_option("--task", help=_("List builds for this task")) parser.add_option("--type", help=_("List builds of this type.")) parser.add_option("--prefix", help=_("Only builds starting with this prefix")) - parser.add_option("--source", help=_("Only builds where the source field matches (glob pattern)")) + parser.add_option("--source", help=_("Only builds where the source field matches " + "(glob pattern)")) parser.add_option("--owner", help=_("List builds built by this owner")) parser.add_option("--volume", help=_("List builds by volume ID")) parser.add_option("-k", "--sort-key", action="append", metavar='FIELD',