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

Function NewRunner

internal/cmdget/cmdget.go:32–54  ·  view source on GitHub ↗

NewRunner returns a command runner

(parent string)

Source from the content-addressed store, hash-verified

30
31// NewRunner returns a command runner
32func 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.
48May 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
56func NewCommand(parent string) *cobra.Command {
57 return NewRunner(parent).Command

Callers 10

TestCmd_executeFunction · 0.92
TestCmd_stdinFunction · 0.92
TestCmd_failFunction · 0.92
TestCmd_gitFunction · 0.92
TestCmdExecuteFunction · 0.92
TestCmd_executeFunction · 0.92
TestCmd_failUnCommittedFunction · 0.92
NewCommandFunction · 0.70

Calls 1

FixDocsFunction · 0.92

Tested by 9

TestCmd_executeFunction · 0.74
TestCmd_stdinFunction · 0.74
TestCmd_failFunction · 0.74
TestCmd_gitFunction · 0.74
TestCmdExecuteFunction · 0.74
TestCmd_executeFunction · 0.74
TestCmd_failUnCommittedFunction · 0.74