MCPcopy
hub / github.com/cli/cli / cleanExtensionUpdateDir

Method cleanExtensionUpdateDir

pkg/cmd/extension/manager.go:872–877  ·  view source on GitHub ↗

cleanExtensionUpdateDir deletes the extension-specific directory containing metadata used in checking for updates. Because extension names are not unique across GitHub organizations and users, we feel its important to clean up this metadata before installing or removing an extension with the same na

(name string)

Source from the content-addressed store, hash-verified

870// This could change over time as other functionality is added to extensions, which we cannot predict within cli/cli#9934,
871// such as extension manifest and lock files within cli/cli#6118.
872func (m *Manager) cleanExtensionUpdateDir(name string) error {
873 if err := os.RemoveAll(m.UpdateDir(name)); err != nil {
874 return fmt.Errorf("failed to remove previous extension update state: %w", err)
875 }
876 return nil
877}
878
879// normalizeExtension makes sure that the provided extension name is prefixed with "gh-".
880func normalizeExtension(name string) string {

Callers 4

InstallLocalMethod · 0.95
installBinMethod · 0.95
installGitMethod · 0.95
RemoveMethod · 0.95

Calls 2

UpdateDirMethod · 0.95
ErrorfMethod · 0.65

Tested by

no test coverage detected