Add KustFactory as a wrapper of all factories

This commit is contained in:
Jingfang Liu
2018-10-11 12:15:08 -07:00
parent 6fa110d4fd
commit 40b2bf76ae
6 changed files with 82 additions and 24 deletions

View File

@@ -25,15 +25,12 @@ import (
"sigs.k8s.io/kustomize/pkg/commands/build"
"sigs.k8s.io/kustomize/pkg/commands/edit"
"sigs.k8s.io/kustomize/pkg/commands/misc"
"sigs.k8s.io/kustomize/pkg/factory"
"sigs.k8s.io/kustomize/pkg/fs"
"sigs.k8s.io/kustomize/pkg/ifc"
"sigs.k8s.io/kustomize/pkg/ifc/transformer"
)
// NewDefaultCommand returns the default (aka root) command for kustomize command.
func NewDefaultCommand(
kf ifc.KunstructuredFactory, ptf transformer.Factory,
validator ifc.Validator) *cobra.Command {
func NewDefaultCommand(f *factory.KustFactory) *cobra.Command {
fsys := fs.MakeRealFS()
stdOut := os.Stdout
@@ -49,8 +46,8 @@ See https://sigs.k8s.io/kustomize
c.AddCommand(
// TODO: Make consistent API for newCmd* functions.
build.NewCmdBuild(stdOut, fsys, kf, ptf),
edit.NewCmdEdit(fsys, validator, kf),
build.NewCmdBuild(stdOut, fsys, f.ResmapF, f.TransformerF),
edit.NewCmdEdit(fsys, f.ValidatorF, f.UnstructF),
misc.NewCmdConfig(fsys),
misc.NewCmdVersion(stdOut),
)