move cmd/util/printing.go#PrintSuccess to factory_builder.go

This commit is contained in:
juanvallejo
2017-10-31 11:58:38 -04:00
parent 1ced91f201
commit 701d6536a2
34 changed files with 151 additions and 88 deletions

View File

@@ -54,6 +54,7 @@ type ImageOptions struct {
Cmd *cobra.Command
ResolveImage func(in string) (string, error)
PrintSuccess func(mapper meta.RESTMapper, shortOutput bool, out io.Writer, resource, name string, dryRun bool, operation string)
PrintObject func(cmd *cobra.Command, isLocal bool, mapper meta.RESTMapper, obj runtime.Object, out io.Writer) error
UpdatePodSpecForObject func(obj runtime.Object, fn func(*v1.PodSpec) error) (bool, error)
Resources []string
@@ -116,6 +117,7 @@ func NewCmdImage(f cmdutil.Factory, out, err io.Writer) *cobra.Command {
func (o *ImageOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
o.Mapper, _ = f.Object()
o.PrintSuccess = f.PrintSuccess
o.UpdatePodSpecForObject = f.UpdatePodSpecForObject
o.Encoder = f.JSONEncoder()
o.Decoder = f.Decoder(true)
@@ -279,7 +281,7 @@ func (o *ImageOptions) Run() error {
}
continue
}
cmdutil.PrintSuccess(o.Mapper, o.ShortOutput, o.Out, info.Mapping.Resource, info.Name, o.DryRun, "image updated")
o.PrintSuccess(o.Mapper, o.ShortOutput, o.Out, info.Mapping.Resource, info.Name, o.DryRun, "image updated")
}
return utilerrors.NewAggregate(allErrs)
}