MCPcopy Create free account
hub / github.com/cli/cli / InstallLocal

Method InstallLocal

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

Source from the content-addressed store, hash-verified

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