(root *cobra.Command)
| 1290 | } |
| 1291 | |
| 1292 | func structuredOutputCommandPaths(root *cobra.Command) []string { |
| 1293 | var paths []string |
| 1294 | var walk func(*cobra.Command, []string) |
| 1295 | walk = func(cmd *cobra.Command, parents []string) { |
| 1296 | parts := parents |
| 1297 | if cmd != root { |
| 1298 | parts = append(append([]string{}, parents...), cmd.Name()) |
| 1299 | if commandSupportsStructuredOutput(cmd) { |
| 1300 | paths = append(paths, strings.Join(parts, " ")) |
| 1301 | } |
| 1302 | } |
| 1303 | for _, child := range cmd.Commands() { |
| 1304 | walk(child, parts) |
| 1305 | } |
| 1306 | } |
| 1307 | walk(root, nil) |
| 1308 | return paths |
| 1309 | } |
| 1310 | |
| 1311 | func TestJSONOperationOutputContractShape(t *testing.T) { |
| 1312 | encoded, err := json.Marshal(newJSONOperationOutput(nil, nil, nil)) |
no test coverage detected