mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-06-03 22:19:23 +00:00
expose pipeline list options to cli
This commit is contained in:
parent
bf2dfd36e5
commit
58fec6049c
|
@ -17,6 +17,7 @@ package pipeline
|
|||
import (
|
||||
"os"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
|
@ -50,6 +51,16 @@ var pipelineListCmd = &cli.Command{
|
|||
Usage: "limit the list size",
|
||||
Value: 25,
|
||||
},
|
||||
&cli.TimestampFlag{
|
||||
Name: "before",
|
||||
Usage: "only return pipelines before this RFC3339 date",
|
||||
Layout: time.RFC3339,
|
||||
},
|
||||
&cli.TimestampFlag{
|
||||
Name: "after",
|
||||
Usage: "only return pipelines after this RFC3339 date",
|
||||
Layout: time.RFC3339,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -64,7 +75,18 @@ func pipelineList(c *cli.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
pipelines, err := client.PipelineList(repoID, woodpecker.PipelineListOptions{})
|
||||
opt := woodpecker.PipelineListOptions{}
|
||||
before := c.Timestamp("before")
|
||||
after := c.Timestamp("after")
|
||||
|
||||
if before != nil {
|
||||
opt.Before = *before
|
||||
}
|
||||
if after != nil {
|
||||
opt.After = *after
|
||||
}
|
||||
|
||||
pipelines, err := client.PipelineList(repoID, opt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -76,4 +76,4 @@ func repoList(c *cli.Context) error {
|
|||
}
|
||||
|
||||
// template for repository list items
|
||||
var tmplRepoList = "\x1b[33m{{ .FullName }}\x1b[0m (id: {{ .ID }}, forgeRemoteID: {{ .ForgeRemoteID }})"
|
||||
var tmplRepoList = "\x1b[33m{{ .FullName }}\x1b[0m (id: {{ .ID }}, forgeRemoteID: {{ .ForgeRemoteID }}, isActive: {{ .IsActive }})"
|
||||
|
|
Loading…
Reference in a new issue