func NewCmdKptRecreate() (*cobra.Command, *Options) {
	o := &Options{}
	cmd := &cobra.Command{
		Use:     "recreate",
		Short:   "Recreates the kpt packages in the given directory",
		Long:    kptLong,
		Example: fmt.Sprintf(kptExample, rootcmd.BinaryName),
		Run: func(cmd *cobra.Command, args []string) {
			err := o.Run()
			helper.CheckErr(err)
		},
	}
	cmd.Flags().StringVarP(&o.Dir, "dir", "d", ".", "the directory to recursively look for the *.yaml or *.yml files")
	cmd.Flags().StringVarP(&o.OutDir, "out-dir", "o", "", "the output directory to generate the output")
	cmd.Flags().StringVarP(&o.Version, "version", "", "", "if specified overrides the versions used in the kpt packages (e.g. to 'master')")
	cmd.Flags().BoolVarP(&o.IgnoreErrors, "ignore-errors", "i", false, "if enabled we continue processing on kpt errors")
	cmd.Flags().BoolVarP(&o.DryRun, "dry-run", "", false, "just output the commands to be executed")
	return cmd, o
}
NewCmdKptRecreate creates a command object for the command
package recreate
import (
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"github.com/jenkins-x-plugins/jx-gitops/pkg/rootcmd"
	"github.com/jenkins-x/jx-helpers/v3/pkg/cmdrunner"
	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras/helper"
	"github.com/jenkins-x/jx-helpers/v3/pkg/cobras/templates"
	"github.com/jenkins-x/jx-helpers/v3/pkg/files"
	"github.com/jenkins-x/jx-logging/v3/pkg/log"
	"github.com/pkg/errors"
	"github.com/spf13/cobra"
	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
	"sigs.k8s.io/yaml"
)
var (
	kptLong = templates.LongDesc(`
		Updates the kpt packages in the given directory
`)
	kptExample = templates.Examples(`
		# updates the kpt of all the yaml resources in the given directory
		%s kpt --dir .
	`)
	pathSeparator = string(os.PathSeparator)
)
type Options struct {
	Dir           string
	OutDir        string
	Version       string
	IgnoreErrors  bool
	DryRun        bool
	CommandRunner cmdrunner.CommandRunner
}