| 267 | } |
| 268 | |
| 269 | func parseOutputFormat(value string) (output.Format, error) { |
| 270 | switch output.Format(value) { |
| 271 | case output.FormatText: |
| 272 | return output.FormatText, nil |
| 273 | case output.FormatJSON: |
| 274 | return output.FormatJSON, nil |
| 275 | default: |
| 276 | return "", invalidArgumentsErrorfWithDetails( |
| 277 | "unsupported output format %q: use text or json", |
| 278 | flagValueErrorDetails(outputFlag, value), |
| 279 | value, |
| 280 | ) |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | func validateOutputFormat(cmd *cobra.Command) error { |
| 285 | format, err := commandOutputFormatE(cmd) |