-
-
Notifications
You must be signed in to change notification settings - Fork 43
/
run_view.go
46 lines (40 loc) · 1.81 KB
/
run_view.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package cmd
import (
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace-bin/completers/gh_completer/cmd/action"
"github.com/spf13/cobra"
)
var run_viewCmd = &cobra.Command{
Use: "view [<run-id>]",
Short: "View a summary of a workflow run",
Run: func(cmd *cobra.Command, args []string) {},
}
func init() {
carapace.Gen(run_viewCmd).Standalone()
run_viewCmd.Flags().StringP("attempt", "a", "", "The attempt number of the workflow run")
run_viewCmd.Flags().Bool("exit-status", false, "Exit with non-zero status if run failed")
run_viewCmd.Flags().StringP("job", "j", "", "View a specific job ID from a run")
run_viewCmd.Flags().StringP("jq", "q", "", "Filter JSON output using a jq `expression`")
run_viewCmd.Flags().StringSlice("json", []string{}, "Output JSON with the specified `fields`")
run_viewCmd.Flags().Bool("log", false, "View full log for either a run or specific job")
run_viewCmd.Flags().Bool("log-failed", false, "View the log for any failed steps in a run or specific job")
run_viewCmd.Flags().StringP("template", "t", "", "Format JSON output using a Go template; see \"gh help formatting\"")
run_viewCmd.Flags().BoolP("verbose", "v", false, "Show job steps")
run_viewCmd.Flags().BoolP("web", "w", false, "Open run in the browser")
runCmd.AddCommand(run_viewCmd)
carapace.Gen(run_viewCmd).FlagCompletion(carapace.ActionMap{
"job": carapace.ActionCallback(func(c carapace.Context) carapace.Action {
if len(c.Args) > 0 {
return action.ActionWorkflowJobs(run_viewCmd, c.Args[0], action.RunOpts{All: true})
}
return carapace.ActionValues()
}),
"json": carapace.Batch(
action.ActionRunFields(),
carapace.ActionValues("jobs"),
).ToA().UniqueList(","),
})
carapace.Gen(run_viewCmd).PositionalCompletion(
action.ActionWorkflowRuns(run_viewCmd, action.RunOpts{All: true}),
)
}