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

@@ -43,7 +43,8 @@ type UndoOptions struct {
ToRevision int64
DryRun bool
Out io.Writer
PrintSuccess func(mapper meta.RESTMapper, shortOutput bool, out io.Writer, resource, name string, dryRun bool, operation string)
Out io.Writer
}
var (
@@ -100,6 +101,7 @@ func (o *UndoOptions) CompleteUndo(f cmdutil.Factory, cmd *cobra.Command, out io
return cmdutil.UsageErrorf(cmd, "Required resource not specified.")
}
o.PrintSuccess = f.PrintSuccess
o.ToRevision = cmdutil.GetFlagInt64(cmd, "to-revision")
o.Mapper, o.Typer = f.Object()
o.Out = out
@@ -146,7 +148,7 @@ func (o *UndoOptions) RunUndo() error {
allErrs = append(allErrs, cmdutil.AddSourceToErr("undoing", info.Source, err))
continue
}
cmdutil.PrintSuccess(o.Mapper, false, o.Out, info.Mapping.Resource, info.Name, false, result)
o.PrintSuccess(o.Mapper, false, o.Out, info.Mapping.Resource, info.Name, false, result)
}
return utilerrors.NewAggregate(allErrs)
}