mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-07 05:46:37 +00:00
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>
This commit is contained in:
@@ -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,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user