MCPcopy
hub / github.com/codeaashu/claude-code / checkAndRestoreITerm2Backup

Function checkAndRestoreITerm2Backup

src/utils/iTermBackup.ts:43–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41 }
42
43export async function checkAndRestoreITerm2Backup(): Promise<RestoreResult> {
44 const { inProgress, backupPath } = getIterm2RecoveryInfo()
45 if (!inProgress) {
46 return { status: 'no_backup' }
47 }
48
49 if (!backupPath) {
50 markITerm2SetupComplete()
51 return { status: 'no_backup' }
52 }
53
54 try {
55 await stat(backupPath)
56 } catch {
57 markITerm2SetupComplete()
58 return { status: 'no_backup' }
59 }
60
61 try {
62 await copyFile(backupPath, getITerm2PlistPath())
63
64 markITerm2SetupComplete()
65 return { status: 'restored' }
66 } catch (restoreError) {
67 logError(
68 new Error(`Failed to restore iTerm2 settings with: ${restoreError}`),
69 )
70 markITerm2SetupComplete()
71 return { status: 'failed', backupPath }
72 }
73}
74

Callers 1

setupFunction · 0.85

Calls 5

getIterm2RecoveryInfoFunction · 0.85
markITerm2SetupCompleteFunction · 0.85
statFunction · 0.85
getITerm2PlistPathFunction · 0.85
logErrorFunction · 0.70

Tested by

no test coverage detected