Run executes the command logic
(f factory.Factory, cobraCmd *cobra.Command, args []string)
| 34 | |
| 35 | // Run executes the command logic |
| 36 | func (cmd *pluginCmd) Run(f factory.Factory, cobraCmd *cobra.Command, args []string) error { |
| 37 | pluginManager := f.NewPluginManager(f.GetLog()) |
| 38 | _, oldPlugin, err := pluginManager.GetByName(args[0]) |
| 39 | if err != nil { |
| 40 | return err |
| 41 | } else if oldPlugin != nil { |
| 42 | // Execute plugin hook |
| 43 | err = plugin.ExecutePluginHookAt(*oldPlugin, "before:removePlugin", "before_remove") |
| 44 | if err != nil { |
| 45 | return err |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | f.GetLog().Info("Removing plugin " + args[0] + "...") |
| 50 | err = pluginManager.Remove(args[0]) |
| 51 | if err != nil { |
| 52 | return err |
| 53 | } |
| 54 | |
| 55 | f.GetLog().Donef("Successfully removed plugin %s", args[0]) |
| 56 | return nil |
| 57 | } |
no test coverage detected