NewRunner returns a command runner.
(parent string)
| 24 | |
| 25 | // NewRunner returns a command runner. |
| 26 | func NewRunner(parent string) *Runner { |
| 27 | r := &Runner{} |
| 28 | c := &cobra.Command{ |
| 29 | Use: "sync LOCAL_PKG_DIR", |
| 30 | Short: docs.SyncShort, |
| 31 | Long: docs.SyncLong, |
| 32 | Example: docs.SyncExamples, |
| 33 | RunE: r.runE, |
| 34 | Args: cobra.ExactArgs(1), |
| 35 | PreRunE: r.preRunE, |
| 36 | } |
| 37 | |
| 38 | c.Flags().BoolVar(&r.Sync.Verbose, "verbose", false, |
| 39 | "print verbose logging information.") |
| 40 | c.Flags().BoolVar(&r.Sync.DryRun, "dry-run", false, |
| 41 | "print sync actions without performing them.") |
| 42 | cmdutil.FixDocs("kpt", parent, c) |
| 43 | r.Command = c |
| 44 | |
| 45 | c.AddCommand(NewSetCommand(parent)) |
| 46 | return r |
| 47 | } |
| 48 | |
| 49 | func NewCommand(parent string) *cobra.Command { |
| 50 | return NewRunner(parent).Command |
no test coverage detected