Skip to content

v0.98.2 — a copy before every overwrite

Choose a tag to compare

@ralyodio ralyodio released this 13 Sep 07:51
93c8d1e

A copy before every overwrite

moshcode load now keeps the previous content of every file it replaces, beside the file, as <name>.bak-NNN.<ext>: aliases.json becomes aliases.bak-001.json, the next time bak-002, and a number is never reused. The sync marker already refused a load that would overwrite an edit made since the last save; the copy covers what the marker cannot see, a forced load and a machine that never synced, so a load is no longer something that can lose your settings. The command says where each copy went, moshcode load --json lists them under backups, and a backup is never synced: the allowlist names files exactly.

This is @profullstack/synconfig 0.1.3 doing the copying, so every tool that syncs its settings through it gets the same protection; moshcode is the first to ship on it.

It comes from losing a ~/.moshcode today to an installer that kept no copy of anything. The house rule is now written down: before an overwrite, a numbered .bak beside the original, every time.