MCPcopy
hub / github.com/cli/cli / IsPinned

Method IsPinned

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

Source from the content-addressed store, hash-verified

148}
149
150func (e *Extension) IsPinned() bool {
151 e.mu.RLock()
152 if e.isPinned != nil {
153 defer e.mu.RUnlock()
154 return *e.isPinned
155 }
156 e.mu.RUnlock()
157
158 var isPinned bool
159 switch e.kind {
160 case LocalKind:
161 case BinaryKind:
162 if manifest, err := e.loadManifest(); err == nil {
163 isPinned = manifest.IsPinned
164 }
165 case GitKind:
166 extDir := filepath.Dir(e.path)
167 pinPath := filepath.Join(extDir, fmt.Sprintf(".pin-%s", e.CurrentVersion()))
168 if _, err := os.Stat(pinPath); err == nil {
169 isPinned = true
170 } else {
171 isPinned = false
172 }
173 }
174
175 e.mu.Lock()
176 e.isPinned = &isPinned
177 e.mu.Unlock()
178
179 return *e.isPinned
180}
181
182func (e *Extension) Owner() string {
183 e.mu.RLock()

Calls 3

loadManifestMethod · 0.95
CurrentVersionMethod · 0.95
JoinMethod · 0.80