todoSubcommand pulls the subcommand from either the JSON envelope or the first positional token. Mirrors the helpers in @coder / @park / @scheduler.
(args []string)
| 59 | // or the first positional token. Mirrors the helpers in @coder / |
| 60 | // @park / @scheduler. |
| 61 | func todoSubcommand(args []string) string { |
| 62 | if len(args) == 0 { |
| 63 | return "" |
| 64 | } |
| 65 | first := strings.TrimSpace(args[0]) |
| 66 | if strings.HasPrefix(first, "{") { |
| 67 | if v := extractStringArg([]string{first}, "cmd", "command"); v != "" { |
| 68 | return v |
| 69 | } |
| 70 | } |
| 71 | return first |
| 72 | } |
| 73 | |
| 74 | // JSONSchema returns the draft-2020-12 schema for @todo input. Three |
| 75 | // subcommand shapes are enumerated via oneOf so the validator rejects |
no test coverage detected