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

Function restoreBackup

pkg/cmd/skills/update/update.go:565–573  ·  view source on GitHub ↗

restoreBackup undoes a partial swap by removing any freshly installed entries and moving the original entries back from backup into dest.

(dest, backup string, movedOut, movedIn []string)

Source from the content-addressed store, hash-verified

563// restoreBackup undoes a partial swap by removing any freshly installed
564// entries and moving the original entries back from backup into dest.
565func restoreBackup(dest, backup string, movedOut, movedIn []string) {
566 for _, name := range movedIn {
567 _ = os.RemoveAll(filepath.Join(dest, name))
568 }
569 for _, name := range movedOut {
570 _ = os.Rename(filepath.Join(backup, name), filepath.Join(dest, name))
571 }
572 _ = os.RemoveAll(backup)
573}
574
575// scanAllAgents walks every registered agent's skill directory (project + user scope) and
576// collects installed skills. Shared install roots are scanned only once.

Callers 1

swapDirectoryContentsFunction · 0.85

Calls 1

JoinMethod · 0.80

Tested by

no test coverage detected