MCPcopy Index your code
hub / github.com/devspace-sh/devspace / Run

Method Run

cmd/update/plugin.go:38–71  ·  view source on GitHub ↗

Run executes the command logic

(f factory.Factory, args []string)

Source from the content-addressed store, hash-verified

36
37// Run executes the command logic
38func (cmd *pluginCmd) Run(f factory.Factory, args []string) error {
39 pluginManager := f.NewPluginManager(f.GetLog())
40 _, oldPlugin, err := pluginManager.GetByName(args[0])
41 if err != nil {
42 return err
43 } else if oldPlugin != nil {
44 // Execute plugin hook
45 err = plugin.ExecutePluginHookAt(*oldPlugin, "before:updatePlugin", "before_update")
46 if err != nil {
47 return err
48 }
49 }
50
51 f.GetLog().Info("Updating plugin " + args[0] + "...")
52 updatedPlugin, err := pluginManager.Update(args[0], cmd.Version)
53 if err != nil {
54 if newestVersion, ok := err.(*plugin.NewestVersionError); ok {
55 f.GetLog().Info(newestVersion.Error())
56 return nil
57 }
58
59 return err
60 }
61
62 f.GetLog().Donef("Successfully updated plugin %s", args[0])
63
64 // Execute plugin hook
65 err = plugin.ExecutePluginHookAt(*updatedPlugin, "after:updatePlugin", "after_update")
66 if err != nil {
67 return err
68 }
69
70 return nil
71}

Callers 1

newPluginCmdFunction · 0.95

Calls 8

ExecutePluginHookAtFunction · 0.92
NewPluginManagerMethod · 0.65
GetLogMethod · 0.65
GetByNameMethod · 0.65
UpdateMethod · 0.65
InfoMethod · 0.45
ErrorMethod · 0.45
DonefMethod · 0.45

Tested by

no test coverage detected