update various commands to adapt the new Factory interface

This commit is contained in:
AdoHe
2016-10-13 08:18:39 +08:00
parent dfae1a27c2
commit b2280a646a
53 changed files with 154 additions and 200 deletions

View File

@@ -80,7 +80,7 @@ var (
var errExit = fmt.Errorf("exit directly")
func NewCmdEdit(f *cmdutil.Factory, out, errOut io.Writer) *cobra.Command {
func NewCmdEdit(f cmdutil.Factory, out, errOut io.Writer) *cobra.Command {
options := &resource.FilenameOptions{}
// retrieve a list of handled resources from printer as valid args
@@ -121,7 +121,7 @@ func NewCmdEdit(f *cmdutil.Factory, out, errOut io.Writer) *cobra.Command {
return cmd
}
func RunEdit(f *cmdutil.Factory, out, errOut io.Writer, cmd *cobra.Command, args []string, options *resource.FilenameOptions) error {
func RunEdit(f cmdutil.Factory, out, errOut io.Writer, cmd *cobra.Command, args []string, options *resource.FilenameOptions) error {
o, err := getPrinter(cmd)
if err != nil {
return err
@@ -321,7 +321,7 @@ func getPrinter(cmd *cobra.Command) (*editPrinterOptions, error) {
}
}
func getMapperAndResult(f *cmdutil.Factory, args []string, options *resource.FilenameOptions) (meta.RESTMapper, *resource.Mapper, *resource.Result, string, error) {
func getMapperAndResult(f cmdutil.Factory, args []string, options *resource.FilenameOptions) (meta.RESTMapper, *resource.Mapper, *resource.Result, string, error) {
cmdNamespace, enforceNamespace, err := f.DefaultNamespace()
if err != nil {
return nil, nil, nil, "", err
@@ -441,7 +441,7 @@ func visitToPatch(originalObj runtime.Object, updates *resource.Info, mapper met
return err
}
func visitAnnotation(cmd *cobra.Command, f *cmdutil.Factory, updates *resource.Info, resourceMapper *resource.Mapper, encoder runtime.Encoder) ([]runtime.Object, error) {
func visitAnnotation(cmd *cobra.Command, f cmdutil.Factory, updates *resource.Info, resourceMapper *resource.Mapper, encoder runtime.Encoder) ([]runtime.Object, error) {
mutatedObjects := []runtime.Object{}
annotationVisitor := resource.NewFlattenListVisitor(updates, resourceMapper)
// iterate through all items to apply annotations