Write the output in the given format to the io.Writer. Unsupported formats will return an error
(out io.Writer, w Writer)
| 61 | // Write the output in the given format to the io.Writer. Unsupported formats |
| 62 | // will return an error |
| 63 | func (o Format) Write(out io.Writer, w Writer) error { |
| 64 | switch o { |
| 65 | case Table: |
| 66 | return w.WriteTable(out) |
| 67 | case JSON: |
| 68 | return w.WriteJSON(out) |
| 69 | case YAML: |
| 70 | return w.WriteYAML(out) |
| 71 | } |
| 72 | return ErrInvalidFormatType |
| 73 | } |
| 74 | |
| 75 | // ParseFormat takes a raw string and returns the matching Format. |
| 76 | // If the format does not exist, ErrInvalidFormatType is returned |