2017-04-06 14:28:09 -04:00
|
|
|
/*
|
2018-08-24 15:03:55 -04:00
|
|
|
Copyright The Helm Authors.
|
2017-04-06 14:28:09 -04:00
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
2025-02-24 10:11:54 -05:00
|
|
|
package cmd
|
2017-04-06 14:28:09 -04:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"io"
|
|
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
2019-02-07 13:40:18 -05:00
|
|
|
|
2025-08-16 17:42:00 -04:00
|
|
|
"helm.sh/helm/v4/internal/plugin"
|
2017-04-06 14:28:09 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const pluginHelp = `
|
|
|
|
|
Manage client-side Helm plugins.
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
func newPluginCmd(out io.Writer) *cobra.Command {
|
|
|
|
|
cmd := &cobra.Command{
|
2020-11-07 09:05:10 -05:00
|
|
|
Use: "plugin",
|
|
|
|
|
Short: "install, list, or uninstall Helm plugins",
|
|
|
|
|
Long: pluginHelp,
|
2017-04-06 14:28:09 -04:00
|
|
|
}
|
|
|
|
|
cmd.AddCommand(
|
|
|
|
|
newPluginInstallCmd(out),
|
|
|
|
|
newPluginListCmd(out),
|
2019-10-28 16:40:20 -04:00
|
|
|
newPluginUninstallCmd(out),
|
2017-05-16 13:07:15 -04:00
|
|
|
newPluginUpdateCmd(out),
|
2025-08-30 13:25:28 -04:00
|
|
|
newPluginPackageCmd(out),
|
|
|
|
|
newPluginVerifyCmd(out),
|
2017-04-06 14:28:09 -04:00
|
|
|
)
|
|
|
|
|
return cmd
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// runHook will execute a plugin hook.
|
2025-08-22 16:12:49 -04:00
|
|
|
func runHook(p plugin.Plugin, event string) error {
|
|
|
|
|
pluginHook, ok := p.(plugin.PluginHook)
|
|
|
|
|
if ok {
|
|
|
|
|
return pluginHook.InvokeHook(event)
|
2017-04-06 14:28:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
}
|