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

Method InstallLocal

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

Source from the content-addressed store, hash-verified

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