(deps commandDeps)
| 2287 | } |
| 2288 | |
| 2289 | func newTaskDependencyAddCommand(deps commandDeps) *cobra.Command { |
| 2290 | var ( |
| 2291 | dependsOnID string |
| 2292 | kindRaw string |
| 2293 | ) |
| 2294 | |
| 2295 | cmd := &cobra.Command{ |
| 2296 | Use: "add <task-id>", |
| 2297 | Short: "Add a dependency edge to a task", |
| 2298 | Args: exactOneNonBlankArg(), |
| 2299 | RunE: func(cmd *cobra.Command, args []string) error { |
| 2300 | client, err := clientFromDeps(deps) |
| 2301 | if err != nil { |
| 2302 | return err |
| 2303 | } |
| 2304 | |
| 2305 | request := AddTaskDependencyRequest{DependsOnTaskID: strings.TrimSpace(dependsOnID)} |
| 2306 | if request.DependsOnTaskID == "" { |
| 2307 | return errors.New("cli: --depends-on is required") |
| 2308 | } |
| 2309 | if strings.TrimSpace(kindRaw) != "" { |
| 2310 | kind, err := parseOptionalTaskDependencyKind(kindRaw) |
| 2311 | if err != nil { |
| 2312 | return err |
| 2313 | } |
| 2314 | request.Kind = kind |
| 2315 | } |
| 2316 | |
| 2317 | updated, err := client.AddTaskDependency(cmd.Context(), args[0], request) |
| 2318 | if err != nil { |
| 2319 | return err |
| 2320 | } |
| 2321 | return writeCommandOutput(cmd, taskDetailBundle(&updated)) |
| 2322 | }, |
| 2323 | } |
| 2324 | cmd.Flags().StringVar(&dependsOnID, "depends-on", "", "Dependency task ID") |
| 2325 | cmd.Flags().StringVar(&kindRaw, taskKindKey, "", "Dependency kind") |
| 2326 | mustMarkFlagRequired(cmd, "depends-on") |
| 2327 | return cmd |
| 2328 | } |
| 2329 | |
| 2330 | func newTaskDependencyRemoveCommand(deps commandDeps) *cobra.Command { |
| 2331 | return &cobra.Command{ |
no test coverage detected