MCPcopy
hub / github.com/helm/helm / newCreateCmd

Function newCreateCmd

pkg/cmd/create.go:63–95  ·  view source on GitHub ↗
(out io.Writer)

Source from the content-addressed store, hash-verified

61}
62
63func newCreateCmd(out io.Writer) *cobra.Command {
64 o := &createOptions{}
65
66 cmd := &cobra.Command{
67 Use: "create NAME",
68 Short: "create a new chart with the given name",
69 Long: createDesc,
70 Args: require.ExactArgs(1),
71 ValidArgsFunction: func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) {
72 if len(args) == 0 {
73 // Allow file completion when completing the argument for the name
74 // which could be a path
75 return nil, cobra.ShellCompDirectiveDefault
76 }
77 // No more completions, so disable file completion
78 return noMoreArgsComp()
79 },
80 RunE: func(_ *cobra.Command, args []string) error {
81 o.name = args[0]
82 o.starterDir = helmpath.DataPath("starters")
83 return o.run(out)
84 },
85 }
86
87 cmd.Flags().StringVarP(&o.starter, "starter", "p", "", "the name or absolute path to Helm starter scaffold")
88 cmd.Flags().StringVar(&o.chartAPIVersion, "chart-api-version", chart.APIVersionV2, "chart API version to use (v2 or v3)")
89
90 if !gates.ChartV3.IsEnabled() {
91 cmd.Flags().MarkHidden("chart-api-version")
92 }
93
94 return cmd
95}
96
97func (o *createOptions) run(out io.Writer) error {
98 fmt.Fprintf(out, "Creating %s\n", o.name)

Callers 1

newRootCmdWithConfigFunction · 0.85

Calls 5

runMethod · 0.95
ExactArgsFunction · 0.92
DataPathFunction · 0.92
noMoreArgsCompFunction · 0.85
IsEnabledMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…