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

Function GetExportRunner

internal/cmdexport/cmdexport.go:37–68  ·  view source on GitHub ↗

GetExportRunner creates a ExportRunner instance and wires it to the corresponding Command.

()

Source from the content-addressed store, hash-verified

35
36// GetExportRunner creates a ExportRunner instance and wires it to the corresponding Command.
37func GetExportRunner() *ExportRunner {
38 r := &ExportRunner{PipelineConfig: &types.PipelineConfig{}}
39 c := &cobra.Command{
40 Use: "export DIR/",
41 Short: fndocs.ExportShort,
42 Long: fndocs.ExportLong,
43 Example: fndocs.ExportExamples,
44 Args: cobra.ExactArgs(1),
45 PreRunE: r.preRunE,
46 RunE: r.runE,
47 }
48
49 c.Flags().StringVarP(
50 &r.WorkflowOrchestrator, "workflow", "w", "",
51 fmt.Sprintf(
52 "specify the workflow orchestrator that the pipeline is generated for. Supported workflow orchestrators are %s.",
53 listSupportedOrchestrators()),
54 )
55 _ = c.MarkFlagRequired("workflow")
56 c.Flags().StringSliceVar(
57 &r.FnPaths, "fn-path", []string{},
58 "read functions from these directories instead of the configuration directory.",
59 )
60 c.Flags().StringVar(
61 &r.OutputFilePath, "output", "",
62 "specify the filename of the generated pipeline. If omitted, the default output is stdout.",
63 )
64
65 r.Command = c
66
67 return r
68}
69
70// The ExportRunner wraps the user's input and runs the command.
71type ExportRunner struct {

Callers 2

TestCmdExportFunction · 0.85
ExportCommandFunction · 0.85

Calls 1

Tested by 1

TestCmdExportFunction · 0.68