MCPcopy
hub / github.com/cli/cli / InstallLocal

Method InstallLocal

pkg/cmd/extension/manager.go:208–236  ·  view source on GitHub ↗
(dir string)

Source from the content-addressed store, hash-verified

206}
207
208func (m *Manager) InstallLocal(dir string) error {
209 name := filepath.Base(dir)
210 if err := m.cleanExtensionUpdateDir(name); err != nil {
211 return err
212 }
213 targetLink := filepath.Join(m.installDir(), name)
214
215 if err := os.MkdirAll(filepath.Dir(targetLink), 0755); err != nil {
216 return err
217 }
218 if err := makeSymlink(dir, targetLink); err != nil {
219 return err
220 }
221
222 // Check if an executable of the same name exists in the target directory.
223 // An error here doesn't indicate a failed extension installation, but
224 // it does indicate that the user will not be able to run the extension until
225 // the executable file is built or created manually somehow.
226 if _, err := os.Stat(filepath.Join(dir, name)); err != nil {
227 if os.IsNotExist(err) {
228 return &ErrExtensionExecutableNotFound{
229 Dir: dir,
230 Name: name,
231 }
232 }
233 return err
234 }
235 return nil
236}
237
238type binManifest struct {
239 Owner string

Callers

nothing calls this directly

Calls 5

installDirMethod · 0.95
BaseMethod · 0.80
JoinMethod · 0.80
makeSymlinkFunction · 0.70

Tested by

no test coverage detected