MCPcopy Create free account
hub / github.com/compozy/agh / newAutomationJobsCommand

Function newAutomationJobsCommand

internal/cli/automation.go:101–151  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

99}
100
101func newAutomationJobsCommand(deps commandDeps) *cobra.Command {
102 var (
103 scopeRaw string
104 workspaceRef string
105 sourceRaw string
106 last int
107 )
108
109 cmd := &cobra.Command{
110 Use: "jobs",
111 Short: "Manage automation jobs",
112 Args: cobra.NoArgs,
113 RunE: func(cmd *cobra.Command, _ []string) error {
114 client, err := clientFromDeps(deps)
115 if err != nil {
116 return err
117 }
118
119 query, err := parseAutomationJobListQuery(
120 cmd.Context(),
121 client,
122 scopeRaw,
123 workspaceRef,
124 sourceRaw,
125 last,
126 )
127 if err != nil {
128 return err
129 }
130
131 jobs, err := client.ListAutomationJobs(cmd.Context(), query)
132 if err != nil {
133 return err
134 }
135 return writeCommandOutput(cmd, automationJobListBundle(jobs))
136 },
137 }
138 cmd.Flags().StringVar(&scopeRaw, automationScopeKey, "", "Filter by scope: global or workspace")
139 cmd.Flags().StringVar(&workspaceRef, "workspace", "", "Filter by workspace path, name, or ID")
140 cmd.Flags().
141 StringVar(&sourceRaw, automationSourceKey, "", "Filter by definition source: config or dynamic")
142 cmd.Flags().IntVar(&last, "last", 0, "Show only the most recent N jobs")
143
144 cmd.AddCommand(newAutomationJobsCreateCommand(deps))
145 cmd.AddCommand(newAutomationJobsGetCommand(deps))
146 cmd.AddCommand(newAutomationJobsUpdateCommand(deps))
147 cmd.AddCommand(newAutomationJobsDeleteCommand(deps))
148 cmd.AddCommand(newAutomationJobsTriggerCommand(deps))
149 cmd.AddCommand(newAutomationJobsHistoryCommand(deps))
150 return cmd
151}
152
153func newAutomationJobsCreateCommand(deps commandDeps) *cobra.Command {
154 var (

Callers 1

newAutomationCommandFunction · 0.85

Tested by

no test coverage detected