MCPcopy
hub / github.com/keploy/keploy / Update

Function Update

cli/update.go:20–51  ·  view source on GitHub ↗

Update retrieves the command to tools Keploy

(ctx context.Context, logger *zap.Logger, _ *config.Config, serviceFactory ServiceFactory, cmdConfigurator CmdConfigurator)

Source from the content-addressed store, hash-verified

18
19// Update retrieves the command to tools Keploy
20func Update(ctx context.Context, logger *zap.Logger, _ *config.Config, serviceFactory ServiceFactory, cmdConfigurator CmdConfigurator) *cobra.Command {
21 var updateCmd = &cobra.Command{
22 Use: "update",
23 Short: "Update Keploy ",
24 Example: "keploy update",
25 RunE: func(cmd *cobra.Command, _ []string) error {
26 disableAnsi, _ := (cmd.Flags().GetBool("disable-ansi"))
27 provider.PrintLogo(os.Stdout, disableAnsi)
28 svc, err := serviceFactory.GetService(ctx, "update")
29 if err != nil {
30 utils.LogError(logger, err, "failed to get service", zap.String("command", cmd.Name()))
31 return nil
32 }
33 var tools toolsSvc.Service
34 var ok bool
35 if tools, ok = svc.(toolsSvc.Service); !ok {
36 utils.LogError(logger, nil, "service doesn't satisfy tools service interface")
37 return nil
38 }
39 err = tools.Update(ctx)
40 if err != nil {
41 utils.LogError(logger, err, "failed to update")
42 }
43 return nil
44 },
45 }
46 if err := cmdConfigurator.AddFlags(updateCmd); err != nil {
47 utils.LogError(logger, err, "failed to add update cmd flags")
48 return nil
49 }
50 return updateCmd
51}

Callers

nothing calls this directly

Calls 7

UpdateMethod · 0.95
PrintLogoFunction · 0.92
LogErrorFunction · 0.92
NameMethod · 0.80
GetServiceMethod · 0.65
AddFlagsMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected