collapse printing paths
This commit is contained in:
@@ -122,7 +122,6 @@ type EnvOptions struct {
|
||||
Cmd *cobra.Command
|
||||
|
||||
UpdatePodSpecForObject func(obj runtime.Object, fn func(*v1.PodSpec) error) (bool, error)
|
||||
PrintObject func(cmd *cobra.Command, obj runtime.Object, out io.Writer) error
|
||||
}
|
||||
|
||||
// NewCmdEnv implements the OpenShift cli env command
|
||||
@@ -199,7 +198,6 @@ func (o *EnvOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []stri
|
||||
o.From = cmdutil.GetFlagString(cmd, "from")
|
||||
o.Prefix = cmdutil.GetFlagString(cmd, "prefix")
|
||||
o.DryRun = cmdutil.GetDryRunFlag(cmd)
|
||||
o.PrintObject = f.PrintObject
|
||||
|
||||
o.EnvArgs = envArgs
|
||||
o.Resources = resources
|
||||
@@ -413,8 +411,8 @@ func (o *EnvOptions) RunEnv(f cmdutil.Factory) error {
|
||||
continue
|
||||
}
|
||||
|
||||
if o.PrintObject != nil && (o.Local || o.DryRun) {
|
||||
if err := o.PrintObject(o.Cmd, patch.Info.AsVersioned(), o.Out); err != nil {
|
||||
if o.Local || o.DryRun {
|
||||
if err := cmdutil.PrintObject(o.Cmd, patch.Info.AsVersioned(), o.Out); err != nil {
|
||||
return err
|
||||
}
|
||||
continue
|
||||
@@ -434,13 +432,13 @@ func (o *EnvOptions) RunEnv(f cmdutil.Factory) error {
|
||||
}
|
||||
|
||||
if len(o.Output) > 0 {
|
||||
if err := o.PrintObject(o.Cmd, info.AsVersioned(), o.Out); err != nil {
|
||||
if err := cmdutil.PrintObject(o.Cmd, info.AsVersioned(), o.Out); err != nil {
|
||||
return err
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
f.PrintSuccess(o.ShortOutput, o.Out, info.Mapping.Resource, info.Name, false, "env updated")
|
||||
cmdutil.PrintSuccess(o.ShortOutput, o.Out, info.Object, false, "env updated")
|
||||
}
|
||||
return utilerrors.NewAggregate(allErrs)
|
||||
}
|
||||
|
Reference in New Issue
Block a user