--- a/printer/printer.go Sun May 07 11:56:37 2017 +0200
+++ b/printer/printer.go Sun May 07 13:06:47 2017 +0200
@@ -10,6 +10,9 @@
"io"
)
+// Options contains options used when creating a ResourcePrinter
+type Options map[string]string
+
// ResourcePrinter is an interface used to print objects.
type ResourcePrinter interface {
// PrintObj receives a runtime object, formats it and prints it to a writer.
@@ -18,16 +21,16 @@
// NewPrinter returns a ResourcePrinter for the specified kind of output.
// It returns nil if the output is not supported.
-func NewPrinter(output, option string) (ResourcePrinter, error) {
+func NewPrinter(output string, options Options) (ResourcePrinter, error) {
switch output {
case "", "plain":
- return NewPrinterPlain(option)
+ return NewPrinterPlain(options)
case "json":
- return NewPrinterJSON(option)
+ return NewPrinterJSON(options)
case "yaml":
- return NewPrinterYAML(option)
+ return NewPrinterYAML(options)
case "template":
- return NewPrinterTemplate(option)
+ return NewPrinterTemplate(options)
}
return nil, fmt.Errorf("unhandled output format")
}