NewRunner returns a command runner
(parent string)
| 30 | |
| 31 | // NewRunner returns a command runner |
| 32 | func NewRunner(parent string) *Runner { |
| 33 | r := &Runner{} |
| 34 | c := &cobra.Command{ |
| 35 | Use: "get REPO_URI[.git]/PKG_PATH[@VERSION] LOCAL_DEST_DIRECTORY", |
| 36 | Args: cobra.ExactArgs(2), |
| 37 | Short: docs.GetShort, |
| 38 | Long: docs.GetShort + "\n" + docs.GetLong, |
| 39 | Example: docs.GetExamples, |
| 40 | RunE: r.runE, |
| 41 | PreRunE: r.preRunE, |
| 42 | SuggestFor: []string{"clone", "cp", "fetch"}, |
| 43 | } |
| 44 | cmdutil.FixDocs("kpt", parent, c) |
| 45 | r.Command = c |
| 46 | c.Flags().StringVar(&r.FilenamePattern, "pattern", filters.DefaultFilenamePattern, |
| 47 | `Pattern to use for writing files. |
| 48 | May contain the following formatting verbs |
| 49 | %n: metadata.name, %s: metadata.namespace, %k: kind |
| 50 | `) |
| 51 | c.Flags().BoolVar(&r.AutoSet, "auto-set", true, |
| 52 | `Automatically perform setters based off the environment`) |
| 53 | return r |
| 54 | } |
| 55 | |
| 56 | func NewCommand(parent string) *cobra.Command { |
| 57 | return NewRunner(parent).Command |