// NewCmdBuild creates a new build command.
NewCmdBuild creates a new build command.
// NewCmdBuild creates a new build command .
func NewCmdBuild(
	out io.Writer, fSys fs.FileSystem,
	v ifc.Validator, rf *resmap.Factory,
	ptf transformer.Factory) *cobra.Command {
	var o Options
	pluginConfig := plugins.DefaultPluginConfig()
	pl := plugins.NewLoader(pluginConfig, rf)
	cmd := &cobra.Command{
		Use:          "build {path}",
		Short:        "Print configuration per contents of " + pgmconfig.KustomizationFileNames[0],
		Example:      examples,
		SilenceUsage: true,
		RunE: func(cmd *cobra.Command, args []string) error {
			err := o.Validate(args)
			if err != nil {
				return err
			}
			return o.RunBuild(out, v, fSys, rf, ptf, pl)
		},
	}
	cmd.Flags().StringVarP(
		&o.outputPath,
		"output", "o", "",
		"If specified, write the build output to this path.")
	loader.AddFlagLoadRestrictor(cmd.Flags())
	plugins.AddFlagEnablePlugins(
		cmd.Flags(), &pluginConfig.Enabled)
	addFlagReorderOutput(cmd.Flags())
	cmd.AddCommand(NewCmdBuildPrune(out, v, fSys, rf, ptf, pl))
	return cmd
}
func NewCmdBuild ( out io . Writer , fSys fs . FileSystem , v ifc . Validator , rf * resmap . Factory , ptf transformer . Factory ) * cobra . Command { var o Options pluginConfig := plugins . DefaultPluginConfig ( ) pl := plugins . NewLoader ( pluginConfig , rf ) cmd := & cobra . Command { Use : " " , Short : " " + pgmconfig . KustomizationFileNames [ 0 ] , Example : examples , SilenceUsage : true , RunE : func ( cmd * cobra . Command , args [ ] string ) error { err := o . Validate ( args ) if err != nil { return err } return o . RunBuild ( out , v , fSys , rf , ptf , pl ) } , } cmd . Flags ( ) . StringVarP ( & o . outputPath , " " , " " , " " , " " ) loader . AddFlagLoadRestrictor ( cmd . Flags ( ) ) plugins . AddFlagEnablePlugins ( cmd . Flags ( ) , & pluginConfig . Enabled ) addFlagReorderOutput ( cmd . Flags ( ) ) cmd . AddCommand ( NewCmdBuildPrune ( out , v , fSys , rf , ptf , pl ) ) return cmd }
NewCmdBuild creates a new build command.
NewCmdBuild creates a new build command .