From 2b6a50508bbdad92679f23ba35647f824d668349 Mon Sep 17 00:00:00 2001 From: Peter Leitzen Date: Thu, 17 Nov 2022 22:24:02 +0100 Subject: [PATCH] feat(ci): add --scope and --source flags for list command --- commands/ci/list/list.go | 8 ++++++++ docs/source/ci/list.md | 2 ++ 2 files changed, 10 insertions(+) diff --git a/commands/ci/list/list.go b/commands/ci/list/list.go index 60f2fc05a..c9fcc02f2 100644 --- a/commands/ci/list/list.go +++ b/commands/ci/list/list.go @@ -41,10 +41,16 @@ func NewCmdList(f *cmdutils.Factory) *cobra.Command { l.Page = 1 l.PerPage = 30 + if m, _ := cmd.Flags().GetString("scope"); m != "" { + l.Scope = gitlab.String(m) + } if m, _ := cmd.Flags().GetString("status"); m != "" { l.Status = gitlab.BuildState(gitlab.BuildStateValue(m)) titleQualifier = m } + if m, _ := cmd.Flags().GetString("source"); m != "" { + l.Source = gitlab.String(m) + } if m, _ := cmd.Flags().GetString("orderBy"); m != "" { l.OrderBy = gitlab.String(m) } @@ -72,7 +78,9 @@ func NewCmdList(f *cmdutils.Factory) *cobra.Command { return nil }, } + pipelineListCmd.Flags().StringP("scope", "", "", "Get pipeline by scope: {running|pending|finished|branches|tags}") pipelineListCmd.Flags().StringP("status", "s", "", "Get pipeline with status: {running|pending|success|failed|canceled|skipped|created|manual}") + pipelineListCmd.Flags().StringP("source", "", "", "Get pipeline from source: {push|web|trigger|schedule|api|external|pipeline|chat|webide|merge_request_event|external_pull_request_event|parent_pipeline|ondemand_dast_scan|ondemand_dast_validation}") pipelineListCmd.Flags().StringP("orderBy", "o", "", "Order pipeline by ") pipelineListCmd.Flags().StringP("sort", "", "desc", "Sort pipeline by {asc|desc}. (Defaults to desc)") pipelineListCmd.Flags().IntP("page", "p", 1, "Page number") diff --git a/docs/source/ci/list.md b/docs/source/ci/list.md index d5fa6867f..eaed1efb3 100644 --- a/docs/source/ci/list.md +++ b/docs/source/ci/list.md @@ -31,7 +31,9 @@ glab ci list --status=failed -o, --orderBy string Order pipeline by -p, --page int Page number (default 1) -P, --per-page int Number of items to list per page. (default 30) (default 30) + --scope string Get pipeline by scope: {running|pending|finished|branches|tags} --sort string Sort pipeline by {asc|desc}. (Defaults to desc) (default "desc") + --source string Get pipeline from source: {push|web|trigger|schedule|api|external|pipeline|chat|webide|merge_request_event|external_pull_request_event|parent_pipeline|ondemand_dast_scan|ondemand_dast_validation} -s, --status string Get pipeline with status: {running|pending|success|failed|canceled|skipped|created|manual} ``` -- GitLab