From 43d51ef28039117431f5d2ab0b43b519e78a9e38 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Thu, 11 Oct 2012 10:58:28 +0200 Subject: [PATCH] gnt-job list: Add option to include archived jobs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This provides a convenience option to include archived jobs in the output list. It's equivalent to using β-o +archivedβ, but tab completion is nicer. Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/client/gnt_job.py | 10 +++++++++- man/gnt-job.rst | 3 +++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/client/gnt_job.py b/lib/client/gnt_job.py index 78eec77f7..3bdbd0d6f 100644 --- a/lib/client/gnt_job.py +++ b/lib/client/gnt_job.py @@ -87,6 +87,9 @@ def ListJobs(opts, args): """ selected_fields = ParseFields(opts.output, _LIST_DEF_FIELDS) + if opts.archived and "archived" not in selected_fields: + selected_fields.append("archived") + fmtoverride = { "status": (_FormatStatus, False), "summary": (lambda value: ",".join(str(item) for item in value), False), @@ -387,12 +390,17 @@ _FINISHED_OPT = \ const=constants.JOBS_FINALIZED, help="Show finished jobs only") +_ARCHIVED_OPT = \ + cli_option("--archived", default=False, + action="store_true", dest="archived", + help="Include archived jobs in list (slow and expensive)") + commands = { "list": ( ListJobs, [ArgJobId()], [NOHDR_OPT, SEP_OPT, FIELDS_OPT, VERBOSE_OPT, FORCE_FILTER_OPT, - _PENDING_OPT, _RUNNING_OPT, _ERROR_OPT, _FINISHED_OPT], + _PENDING_OPT, _RUNNING_OPT, _ERROR_OPT, _FINISHED_OPT, _ARCHIVED_OPT], "[job_id ...]", "Lists the jobs and their status. The available fields can be shown" " using the \"list-fields\" command (see the man page for details)." diff --git a/man/gnt-job.rst b/man/gnt-job.rst index 58adc1842..56d381746 100644 --- a/man/gnt-job.rst +++ b/man/gnt-job.rst @@ -81,6 +81,9 @@ fields will be added to the default list. This allows one to quickly see the default list plus a few other fields, instead of retyping the entire list of fields. +To include archived jobs in the list the ``--archived`` option can be +used. + The following options can be used to show only specific jobs: ``--pending`` -- GitLab