A safe editing wrapper: edits a temp copy, compares, and saves original backup if changed.
Project description
mirro
mirro is a tiny safety-first editing wrapper for text files. You edit a temporary file, mirro detects whether anything changed, and if it did, it saves a backup of the original before writing your changes.
Why mirro?
Well... have you ever been in the “ugh, I forgot to back this up first” situation?
No?
Stop lying... 🥸
mirro gives you a built-in safety net:
-
never edits the real file directly
-
detects whether the edit actually changed content
-
creates a timestamped backup only when changes occurred
-
clearly labels backups so you know exactly what they came from
-
respects the user’s
$EDITORwhen possible -
requires
sudoonly when actually needed
It’s simple, predictable, and hard to misuse.
I mean... the only thing you need to remember is to use it.
How it works
mirro reads the original file (or pre-populates new files with a friendly message).
It writes that content into a temporary file.
It launches your $EDITOR to edit the temp file.
When the editor closes, mirro compares old vs new.
If nothing changed:
file hasn't changed
If changed:
file changed; original backed up at: ~/.local/share/mirro/ (or /root/.local/share/mirro/ under sudo)
Backed up files include a header:
# ---------------------------------------------
# mirro backup
# Original file: /path/to/whatever.conf
# Timestamp: 2025-11-10 17:44:00 UTC
# ---------------------------------------------
So you never lose track of the original location.
Backup directory
By default all the backups will be stored at:
~/.local/share/mirro/
so under sudo:
/root/.local/share/mirro/
Backups are named like:
filename.ext.orig.20251110T174400.bak
Installation
NOTE: To use mirro with sudo, the path to mirro must be in the $PATH seen by root. Either install mirro as root (preferred), use sudo -E mirro, or add the $PATH to /etc/sudoers using its Defaults secure_path parameter.
Install via PyPI (preferred):
pip install mirro
Or clone the repo and install locally:
git clone https://github.com/mdaleo404/mirro.git
cd mirro/
poetry install
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mirro-0.1.0.tar.gz.
File metadata
- Download URL: mirro-0.1.0.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.9 Linux/6.17.7-200.fc42.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc11e3777b9949ec048197bdf160efc3d812b3be26a2a131d7567eb6a9c4e039
|
|
| MD5 |
4de97c92303f1c41eb277b54068c9a6d
|
|
| BLAKE2b-256 |
a41eba612ad48f6afeed9a6e6d040401b4300df3cca29b9d9f2aaf64d1eac223
|
File details
Details for the file mirro-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mirro-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.9 Linux/6.17.7-200.fc42.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90e8d8f3f61ee3612455d62c1270916c3caf6da606e6581893ea66c992a34039
|
|
| MD5 |
c116b81e6c8eef872575ef9aa65f3644
|
|
| BLAKE2b-256 |
788c9a267a45dc39c41d932a6d1020f4ab9168e27a97cac416a50b5abb0c1541
|