()
| 66 | } |
| 67 | |
| 68 | func (f *PrintFlags) ToPrinter() (printers.Printer, error) { |
| 69 | outputFormat := "" |
| 70 | if f.OutputFormat != nil { |
| 71 | outputFormat = *f.OutputFormat |
| 72 | } |
| 73 | |
| 74 | if f.JSONPrintFlags != nil { |
| 75 | if p, err := f.JSONPrintFlags.ToPrinter(outputFormat); !IsNoCompatiblePrinterError(err) { |
| 76 | return p, err |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | if f.JSONPathPrintFlags != nil { |
| 81 | if p, err := f.JSONPathPrintFlags.ToPrinter(outputFormat); !IsNoCompatiblePrinterError( |
| 82 | err, |
| 83 | ) { |
| 84 | return p, err |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | return nil, NoCompatiblePrinterError{ |
| 89 | OutputFormat: f.OutputFormat, |
| 90 | AllowedFormats: f.AllowedFormats(), |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | // Print renders a value with the configured printer. |
| 95 | func (f *PrintFlags) Print(ios *iostreams.IOStreams, value interface{}) error { |
no test coverage detected