(value string)
| 14 | ) |
| 15 | |
| 16 | func OutputFormatFromString(value string) (OutputFormat, error) { |
| 17 | switch value { |
| 18 | case "json": |
| 19 | return OutputFormatJSON, nil |
| 20 | case "text": |
| 21 | return OutputFormatText, nil |
| 22 | default: |
| 23 | return OutputFormatJSON, fmt.Errorf("invalid output format '%s'", value) |
| 24 | } |
| 25 | } |