MCPcopy Create free account
hub / github.com/algolia/cli / ToPrinter

Method ToPrinter

pkg/cmdutil/print_flags.go:68–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66}
67
68func (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.
95func (f *PrintFlags) Print(ios *iostreams.IOStreams, value interface{}) error {

Callers 15

PrintMethod · 0.95
printTargetsFunction · 0.45
runGetCmdFunction · 0.45
runBrowseCmdFunction · 0.45
runSearchCmdFunction · 0.45
runBrowseCmdFunction · 0.45
runListCmdFunction · 0.45
runListCmdFunction · 0.45
changePlanFunction · 0.45
runUpdateCmdFunction · 0.45
runListCmdFunction · 0.45
createApplicationFunction · 0.45

Calls 2

AllowedFormatsMethod · 0.95

Tested by

no test coverage detected