diff --git a/pkg/oc/cli/cmd/create/create.go b/pkg/oc/cli/cmd/create/create.go index 26e8fdcc8bd8..5713a708f170 100644 --- a/pkg/oc/cli/cmd/create/create.go +++ b/pkg/oc/cli/cmd/create/create.go @@ -5,8 +5,7 @@ import ( "github.com/spf13/cobra" - "k8s.io/kubernetes/pkg/api/legacyscheme" - "k8s.io/kubernetes/pkg/kubectl/cmd/create" + "github.com/openshift/origin/pkg/oc/util/ocscheme" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/genericclioptions" "k8s.io/kubernetes/pkg/kubectl/genericclioptions/printers" @@ -17,7 +16,7 @@ type CreateSubcommandOptions struct { genericclioptions.IOStreams // PrintFlags holds options necessary for obtaining a printer - PrintFlags *create.PrintFlags + PrintFlags *genericclioptions.PrintFlags // Name of resource being created Name string // DryRun is true if the command should be simulated but not run against the server @@ -31,7 +30,7 @@ type CreateSubcommandOptions struct { func NewCreateSubcommandOptions(ioStreams genericclioptions.IOStreams) *CreateSubcommandOptions { return &CreateSubcommandOptions{ - PrintFlags: create.NewPrintFlags("created", legacyscheme.Scheme), + PrintFlags: genericclioptions.NewPrintFlags("created").WithTypeSetter(ocscheme.PrintingInternalScheme), IOStreams: ioStreams, } } diff --git a/pkg/oc/cli/cmd/create/route.go b/pkg/oc/cli/cmd/create/route.go index aa96707c92f1..f93ac083d897 100644 --- a/pkg/oc/cli/cmd/create/route.go +++ b/pkg/oc/cli/cmd/create/route.go @@ -6,15 +6,14 @@ import ( "github.com/spf13/cobra" "k8s.io/apimachinery/pkg/api/meta" - "k8s.io/kubernetes/pkg/api/legacyscheme" kclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" - "k8s.io/kubernetes/pkg/kubectl/cmd/create" "k8s.io/kubernetes/pkg/kubectl/cmd/templates" kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/genericclioptions" "k8s.io/kubernetes/pkg/kubectl/genericclioptions/printers" routev1client "github.com/openshift/client-go/route/clientset/versioned/typed/route/v1" + "github.com/openshift/origin/pkg/oc/util/ocscheme" ) var ( @@ -44,7 +43,7 @@ func NewCmdCreateRoute(fullName string, f kcmdutil.Factory, streams genericcliop // CreateRouteSubcommandOptions is an options struct to support create subcommands type CreateRouteSubcommandOptions struct { // PrintFlags holds options necessary for obtaining a printer - PrintFlags *create.PrintFlags + PrintFlags *genericclioptions.PrintFlags // Name of resource being created Name string ServiceName string @@ -66,7 +65,7 @@ type CreateRouteSubcommandOptions struct { func NewCreateRouteSubcommandOptions(ioStreams genericclioptions.IOStreams) *CreateRouteSubcommandOptions { return &CreateRouteSubcommandOptions{ - PrintFlags: create.NewPrintFlags("created", legacyscheme.Scheme), + PrintFlags: genericclioptions.NewPrintFlags("created").WithTypeSetter(ocscheme.PrintingInternalScheme), IOStreams: ioStreams, } } diff --git a/pkg/oc/cli/cmd/debug.go b/pkg/oc/cli/cmd/debug.go index 95b5c64862ee..53e0dd1ffd37 100644 --- a/pkg/oc/cli/cmd/debug.go +++ b/pkg/oc/cli/cmd/debug.go @@ -267,9 +267,14 @@ func (o *DebugOptions) Complete(cmd *cobra.Command, f kcmdutil.Factory, args []s } o.AsNonRoot = !o.AsRoot && cmd.Flag("as-root").Changed + templateArgSpecified := o.PrintFlags.TemplatePrinterFlags != nil && + o.PrintFlags.TemplatePrinterFlags.TemplateArgument != nil && + len(*o.PrintFlags.TemplatePrinterFlags.TemplateArgument) > 0 + + outputFormatSpecified := o.PrintFlags.OutputFormat != nil && len(*o.PrintFlags.OutputFormat) > 0 + // TODO: below should be turned into a method on PrintFlags - if (o.PrintFlags.OutputFormat != nil && len(*o.PrintFlags.OutputFormat) > 0) || - (o.PrintFlags.TemplatePrinterFlags != nil && o.PrintFlags.TemplatePrinterFlags.TemplateArgument != nil) { + if outputFormatSpecified || templateArgSpecified { if o.DryRun { o.PrintFlags.Complete("%s (dry run)") }