| 82 | } |
| 83 | |
| 84 | func resolveSetTaskID(cmd *cobra.Command, args []string) (string, error) { |
| 85 | positional := "" |
| 86 | if len(args) > 0 { |
| 87 | positional = args[0] |
| 88 | } |
| 89 | flagVal := setTaskID |
| 90 | |
| 91 | if positional != "" && flagVal != "" && positional != flagVal { |
| 92 | return "", fmt.Errorf("conflicting task ID: positional argument %q and --task-id %q differ", positional, flagVal) |
| 93 | } |
| 94 | |
| 95 | if positional != "" { |
| 96 | return positional, nil |
| 97 | } |
| 98 | if flagVal != "" { |
| 99 | return flagVal, nil |
| 100 | } |
| 101 | return "", fmt.Errorf("task ID required: provide as positional argument or --task-id flag") |
| 102 | } |
| 103 | |
| 104 | func runSet(cmd *cobra.Command, args []string) error { |
| 105 | taskID, err := resolveSetTaskID(cmd, args) |