MCPcopy Create free account
hub / github.com/anchordotdev/cli / runTUI

Method runTUI

version/upgrade.go:26–58  ·  view source on GitHub ↗
(ctx context.Context, drv *ui.Driver)

Source from the content-addressed store, hash-verified

24}
25
26func (c Upgrade) runTUI(ctx context.Context, drv *ui.Driver) error {
27 cli.SkipReleaseCheck = true
28
29 drv.Activate(ctx, models.VersionUpgradeHeader)
30
31 if c.Clipboard == nil {
32 c.Clipboard = clipboard.System
33 }
34
35 command := "brew update && brew upgrade anchor"
36 if isWindowsRuntime(cli.ConfigFromContext(ctx)) {
37 command = "winget update Anchor.cli"
38 }
39
40 isUpgradeable, err := cli.IsUpgradeable(ctx)
41 if err != nil {
42 return err
43 }
44
45 clipboardErr := c.Clipboard.WriteAll(command)
46
47 if isUpgradeable {
48 drv.Activate(ctx, &models.VersionUpgrade{
49 InClipboard: (clipboardErr == nil),
50 Command: command,
51 })
52
53 return nil
54 }
55
56 drv.Activate(ctx, &models.VersionUpgradeUnavailable)
57 return nil
58}

Callers

nothing calls this directly

Calls 5

ConfigFromContextFunction · 0.92
IsUpgradeableFunction · 0.92
isWindowsRuntimeFunction · 0.85
ActivateMethod · 0.80
WriteAllMethod · 0.65

Tested by

no test coverage detected