MCPcopy
hub / github.com/cli/cli / CurrentVersion

Method CurrentVersion

pkg/cmd/extension/extension.go:88–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86}
87
88func (e *Extension) CurrentVersion() string {
89 e.mu.RLock()
90 if e.currentVersion != "" {
91 defer e.mu.RUnlock()
92 return e.currentVersion
93 }
94 e.mu.RUnlock()
95
96 var currentVersion string
97 switch e.kind {
98 case LocalKind:
99 case BinaryKind:
100 if manifest, err := e.loadManifest(); err == nil {
101 currentVersion = manifest.Tag
102 }
103 case GitKind:
104 if sha, err := e.gitClient.CommandOutput([]string{"rev-parse", "HEAD"}); err == nil {
105 currentVersion = string(bytes.TrimSpace(sha))
106 }
107 }
108
109 e.mu.Lock()
110 e.currentVersion = currentVersion
111 e.mu.Unlock()
112
113 return e.currentVersion
114}
115
116func (e *Extension) LatestVersion() string {
117 e.mu.RLock()

Callers 2

IsPinnedMethod · 0.95
UpdateAvailableMethod · 0.95

Calls 2

loadManifestMethod · 0.95
CommandOutputMethod · 0.65

Tested by

no test coverage detected