Stop passing encoder/decoder to NewHumanReadablePrinter

We only need them if we've got unstructured/unknown data and we want to
convert it to typed objects.

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
pull/157/head
Andy Goldstein 2017-10-30 14:07:58 -04:00
parent 39f0a4e561
commit 0fab2e5e89
1 changed files with 2 additions and 9 deletions

View File

@ -28,9 +28,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/kubernetes/pkg/printers"
"github.com/heptio/ark/pkg/apis/ark/v1"
"github.com/heptio/ark/pkg/cmd/util/flag"
"github.com/heptio/ark/pkg/generated/clientset/versioned/scheme"
"github.com/heptio/ark/pkg/util/encode"
)
@ -155,11 +153,6 @@ func printTable(cmd *cobra.Command, obj runtime.Object) (bool, error) {
// NewPrinter returns a printer for doing human-readable table printing of
// Ark objects.
func NewPrinter(cmd *cobra.Command) (*printers.HumanReadablePrinter, error) {
encoder, err := encode.EncoderFor("json")
if err != nil {
return nil, err
}
options := printers.PrintOptions{
NoHeaders: flag.GetOptionalBoolFlag(cmd, "no-headers"),
ShowLabels: GetShowLabelsValue(cmd),
@ -167,8 +160,8 @@ func NewPrinter(cmd *cobra.Command) (*printers.HumanReadablePrinter, error) {
}
printer := printers.NewHumanReadablePrinter(
encoder,
scheme.Codecs.UniversalDecoder(v1.SchemeGroupVersion),
nil, // encoder, only needed if we want/need to convert unstructured/unknown to typed objects
nil, // decoder, only needed if we want/need to convert unstructured/unknown to typed objects
options,
)