diff options
| -rw-r--r-- | CLAUDE.md | 4 | ||||
| -rw-r--r-- | README.md | 6 | ||||
| -rw-r--r-- | config.example | 6 |
3 files changed, 15 insertions, 1 deletions
@@ -18,10 +18,12 @@ No build step. No tests. No deps beyond bash + rsync + git. `dot-backup.sh` does three things in sequence: -1. **Setup** — ensures `$DEFAULT_OUTPUT_DIR` exists with `home/` and `system/` subdirs; initializes git if needed; writes `lastupdate` timestamp +1. **Setup** — ensures `$DEFAULT_OUTPUT_DIR` exists with `home/` and `system/` subdirs; initializes git if needed; writes `lastupdate` timestamp and `lastupdate.epoch` (epoch seconds, machine-readable) 2. **Copy loop** — iterates `DOTFILES` array; paths starting with `/` go to `system/`, all others go to `home/`; uses `rsync -a` for both files and directories 3. **Commit** — `git add .` + auto-commits with timestamp message in `$DEFAULT_OUTPUT_DIR`; optionally pushes with `--push` +`--suggest` is a read-only shortcut: it reads `lastupdate.epoch`, scans `~/.config` children and top-level hidden dirs/files in `$HOME`, and prints any that are newer than the last backup and not already tracked, formatted as a paste-ready block for `files.list`. Prints and exits — never copies or commits. Basenames to skip are controlled by `SUGGEST_IGNORE` (baked-in default; override in config). + ## Key Variables | Variable | Default | Purpose | @@ -64,6 +64,7 @@ git push -u origin master -v, --verbose Print each file as rsync transfers it -r, --restore Restore dotfiles from backup to original locations -q, --quiet Suppress stdout; write output to log instead + -s, --suggest List untracked config dirs/files new since last backup, then exit -p, --push Push to remote after commit -h, --help Show this help ``` @@ -129,10 +130,13 @@ LOG_FILE="${HOME}/.local/share/dot-backup/backup.log" DOTFILES_LIST="${HOME}/.config/dot-backup/files.list" GIT_REMOTE="git@github.com:you/my-dotfiles.git" GIT_BRANCH="master" +SUGGEST_IGNORE=(.cache .local .git .ssh ...) ``` `GIT_REMOTE` — if set, script ensures it is registered as `origin` on every run. Required for `--push`. `GIT_BRANCH` defaults to the current branch if unset. +`SUGGEST_IGNORE` — basenames `--suggest` skips when scanning for new config (overrides the baked-in default). See `config.example` for the full default list. + ## Adding Files **External list (recommended)** — create `~/.config/dot-backup/files.list` with one path per line. When this file exists and is non-empty it replaces the built-in list entirely: @@ -150,3 +154,5 @@ GIT_BRANCH="master" **Built-in fallback** — if `files.list` is missing or empty, the script uses the `DOTFILES` array hardcoded in `dot-backup.sh`. Relative paths are treated as `$HOME`-relative. Absolute paths (starting with `/`) are treated as system files. + +**Discovering new files** — `--suggest` scans `~/.config` children and top-level hidden dirs/files in `$HOME`, and prints any that are newer than the last backup and not already tracked, formatted for pasting into `files.list`. It never copies or commits. Tune what it skips with `SUGGEST_IGNORE` in the config file. diff --git a/config.example b/config.example index 79e716d..cbd419e 100644 --- a/config.example +++ b/config.example @@ -15,3 +15,9 @@ # Branch to push to when using -p/--push (defaults to current branch if unset) #GIT_BRANCH="master" + +# Basenames --suggest skips when scanning for new config (override the +# baked-in default). Uncomment and edit to customize. +#SUGGEST_IGNORE=(.cache .local .git .ssh .gnupg .Trash .pki .nv \ +# .mozilla .thunderbird .npm .cargo .rustup .java \ +# .dbus .config) |
