(deps commandDeps)
| 2369 | } |
| 2370 | |
| 2371 | func newTaskRunListCommand(deps commandDeps) *cobra.Command { |
| 2372 | var ( |
| 2373 | statusRaw string |
| 2374 | sessionID string |
| 2375 | last int |
| 2376 | ) |
| 2377 | |
| 2378 | cmd := &cobra.Command{ |
| 2379 | Use: "list <task-id>", |
| 2380 | Short: "List runs for a task", |
| 2381 | Args: exactOneNonBlankArg(), |
| 2382 | RunE: func(cmd *cobra.Command, args []string) error { |
| 2383 | client, err := clientFromDeps(deps) |
| 2384 | if err != nil { |
| 2385 | return err |
| 2386 | } |
| 2387 | |
| 2388 | query, err := parseTaskRunListFilters(statusRaw, sessionID, last) |
| 2389 | if err != nil { |
| 2390 | return err |
| 2391 | } |
| 2392 | |
| 2393 | runs, err := client.ListTaskRuns(cmd.Context(), args[0], query) |
| 2394 | if err != nil { |
| 2395 | return err |
| 2396 | } |
| 2397 | return writeCommandOutput(cmd, taskRunListBundle(runs)) |
| 2398 | }, |
| 2399 | } |
| 2400 | cmd.Flags().StringVar(&statusRaw, taskStatusKey, "", "Filter by run status") |
| 2401 | cmd.Flags().StringVar(&sessionID, "session", "", "Filter by attached session ID") |
| 2402 | cmd.Flags().IntVar(&last, "last", 0, "Show only the most recent N runs") |
| 2403 | return cmd |
| 2404 | } |
| 2405 | |
| 2406 | func newTaskRunShowCommand(deps commandDeps) *cobra.Command { |
| 2407 | return &cobra.Command{ |
no test coverage detected