MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / newPluginInstallCmd

Function newPluginInstallCmd

app/cli/cmd/plugins.go:255–286  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

253}
254
255func newPluginInstallCmd() *cobra.Command {
256 var file string
257 var location string
258
259 cmd := &cobra.Command{
260 Use: "install",
261 Short: "Install a plugin",
262 Long: "Install a plugin to the plugins directory from a specified URL or local file.",
263 RunE: func(cmd *cobra.Command, _ []string) error {
264 ctx := cmd.Context()
265
266 opts := &action.PluginInstallOptions{
267 File: file,
268 Location: location,
269 }
270
271 result, err := action.NewPluginInstall(ActionOpts, pluginManager).Run(ctx, opts)
272 if err != nil {
273 return fmt.Errorf("failed to install plugin: %w", err)
274 }
275
276 fmt.Printf("Plugin installed successfully to: %s\n", result.FilePath)
277 return nil
278 },
279 }
280
281 // Common flags
282 cmd.Flags().StringVarP(&file, "file", "f", "", "URL or path to the plugin to install")
283 cobra.CheckErr(cmd.MarkFlagRequired("file"))
284
285 return cmd
286}
287
288// findCommand recursively searches for a command by name in the command tree
289func findCommand(rootCmd *cobra.Command, name string) *cobra.Command {

Callers 1

newPluginCmdFunction · 0.85

Calls 3

NewPluginInstallFunction · 0.92
ContextMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected