feat: add -a flag to gh run list
This commit is contained in:
parent
140edf7327
commit
a10e532898
1 changed files with 15 additions and 2 deletions
|
|
@ -5,6 +5,8 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/MakeNowJust/heredoc"
|
||||
|
||||
"github.com/cli/cli/v2/api"
|
||||
"github.com/cli/cli/v2/internal/ghrepo"
|
||||
"github.com/cli/cli/v2/internal/tableprinter"
|
||||
|
|
@ -35,6 +37,7 @@ type ListOptions struct {
|
|||
Event string
|
||||
Created string
|
||||
Commit string
|
||||
All bool
|
||||
|
||||
now time.Time
|
||||
}
|
||||
|
|
@ -52,8 +55,14 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
|
|||
}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "list",
|
||||
Short: "List recent workflow runs",
|
||||
Use: "list",
|
||||
Short: "List recent workflow runs",
|
||||
Long: heredoc.Docf(`
|
||||
List recent workflow runs.
|
||||
|
||||
Note that providing the %[1]sworkflow_name%[1]s to the %[1]s-w%[1]s flag will not fetch disabled workflows.
|
||||
Also pass the %[1]s-a%[1]s flag to fetch disabled workflow runs using the %[1]sworkflow_name%[1]s and the %[1]s-w%[1]s flag.
|
||||
`, "`"),
|
||||
Aliases: []string{"ls"},
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
|
|
@ -79,6 +88,7 @@ func NewCmdList(f *cmdutil.Factory, runF func(*ListOptions) error) *cobra.Comman
|
|||
cmd.Flags().StringVarP(&opts.Event, "event", "e", "", "Filter runs by which `event` triggered the run")
|
||||
cmd.Flags().StringVarP(&opts.Created, "created", "", "", "Filter runs by the `date` it was created")
|
||||
cmd.Flags().StringVarP(&opts.Commit, "commit", "c", "", "Filter runs by the `SHA` of the commit")
|
||||
cmd.Flags().BoolVarP(&opts.All, "all", "a", false, "Include disabled workflows")
|
||||
cmdutil.StringEnumFlag(cmd, &opts.Status, "status", "s", "", shared.AllStatuses, "Filter runs by status")
|
||||
cmdutil.AddJSONFlags(cmd, &opts.Exporter, shared.RunFields)
|
||||
|
||||
|
|
@ -111,6 +121,9 @@ func listRun(opts *ListOptions) error {
|
|||
opts.IO.StartProgressIndicator()
|
||||
if opts.WorkflowSelector != "" {
|
||||
states := []workflowShared.WorkflowState{workflowShared.Active}
|
||||
if opts.All {
|
||||
states = append(states, workflowShared.DisabledManually, workflowShared.DisabledInactivity)
|
||||
}
|
||||
if workflow, err := workflowShared.ResolveWorkflow(
|
||||
opts.Prompter, opts.IO, client, baseRepo, false, opts.WorkflowSelector,
|
||||
states); err == nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue