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

Function restoreBackup

pkg/cmd/skills/update/update.go:512–520  ·  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

510// restoreBackup undoes a partial swap by removing any freshly installed
511// entries and moving the original entries back from backup into dest.
512func restoreBackup(dest, backup string, movedOut, movedIn []string) {
513 for _, name := range movedIn {
514 _ = os.RemoveAll(filepath.Join(dest, name))
515 }
516 for _, name := range movedOut {
517 _ = os.Rename(filepath.Join(backup, name), filepath.Join(dest, name))
518 }
519 _ = os.RemoveAll(backup)
520}
521
522// scanAllAgents walks every registered agent's skill directory (project + user scope) and
523// 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