MCPcopy
hub / github.com/helm/helm / newPluginInstallCmd

Function newPluginInstallCmd

pkg/cmd/plugin_install.go:61–97  ·  view source on GitHub ↗
(out io.Writer)

Source from the content-addressed store, hash-verified

59`
60
61func newPluginInstallCmd(out io.Writer) *cobra.Command {
62 o := &pluginInstallOptions{}
63 cmd := &cobra.Command{
64 Use: "install [options] <path|url>",
65 Short: "install a Helm plugin",
66 Long: pluginInstallDesc,
67 Aliases: []string{"add"},
68 Args: require.ExactArgs(1),
69 ValidArgsFunction: func(_ *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective) {
70 if len(args) == 0 {
71 // We do file completion, in case the plugin is local
72 return nil, cobra.ShellCompDirectiveDefault
73 }
74 // No more completion once the plugin path has been specified
75 return noMoreArgsComp()
76 },
77 PreRunE: func(_ *cobra.Command, args []string) error {
78 return o.complete(args)
79 },
80 RunE: func(_ *cobra.Command, _ []string) error {
81 return o.run(out)
82 },
83 }
84 cmd.Flags().StringVar(&o.version, "version", "", "specify a version constraint. If this is not specified, the latest version is installed")
85 cmd.Flags().BoolVar(&o.verify, "verify", true, "verify the plugin signature before installing")
86 cmd.Flags().StringVar(&o.keyring, "keyring", defaultKeyring(), "location of public keys used for verification")
87
88 // Add OCI-specific flags
89 cmd.Flags().StringVar(&o.certFile, "cert-file", "", "identify registry client using this SSL certificate file")
90 cmd.Flags().StringVar(&o.keyFile, "key-file", "", "identify registry client using this SSL key file")
91 cmd.Flags().StringVar(&o.caFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle")
92 cmd.Flags().BoolVar(&o.insecureSkipTLSVerify, "insecure-skip-tls-verify", false, "skip tls certificate checks for the plugin download")
93 cmd.Flags().BoolVar(&o.plainHTTP, "plain-http", false, "use insecure HTTP connections for the plugin download")
94 cmd.Flags().StringVar(&o.username, "username", "", "registry username")
95 cmd.Flags().StringVar(&o.password, "password", "", "registry password")
96 return cmd
97}
98
99func (o *pluginInstallOptions) complete(args []string) error {
100 o.source = args[0]

Callers 1

newPluginCmdFunction · 0.85

Calls 5

completeMethod · 0.95
runMethod · 0.95
ExactArgsFunction · 0.92
noMoreArgsCompFunction · 0.85
defaultKeyringFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…