MCPcopy
hub / github.com/kptdev/kpt / NewRunner

Function NewRunner

internal/cmdinit/cmdinit.go:37–56  ·  view source on GitHub ↗

NewRunner returns a command runner.

(parent string)

Source from the content-addressed store, hash-verified

35
36// NewRunner returns a command runner.
37func NewRunner(parent string) *Runner {
38 r := &Runner{}
39 c := &cobra.Command{
40 Use: "init DIR",
41 Args: cobra.ExactArgs(1),
42 Short: docs.InitShort,
43 Long: docs.InitShort + "\n" + docs.InitLong,
44 Example: docs.InitExamples,
45 RunE: r.runE,
46 PreRunE: r.preRunE,
47 }
48
49 c.Flags().StringVar(&r.Description, "description", "sample description", "short description of the package.")
50 c.Flags().StringVar(&r.Name, "name", "", "package name. defaults to the directory base name.")
51 c.Flags().StringSliceVar(&r.Tags, "tag", []string{}, "list of tags for the package.")
52 c.Flags().StringVar(&r.URL, "url", "", "link to page with information about the package.")
53 cmdutil.FixDocs("kpt", parent, c)
54 r.Command = c
55 return r
56}
57
58func NewCommand(parent string) *cobra.Command {
59 return NewRunner(parent).Command

Callers 4

TestCmdFunction · 0.92
TestCmd_currentDirFunction · 0.92
TestCmd_failNotExistsFunction · 0.92
NewCommandFunction · 0.70

Calls 1

FixDocsFunction · 0.92

Tested by 3

TestCmdFunction · 0.74
TestCmd_currentDirFunction · 0.74
TestCmd_failNotExistsFunction · 0.74