diff --git a/README.md b/README.md new file mode 100644 index 0000000..bcf0d9a --- /dev/null +++ b/README.md @@ -0,0 +1,79 @@ +# renamer + +`renamer` is a preview-first, undoable batch renaming CLI for local file systems. It wraps a traversal engine, scoped filters, and a newline-delimited `.renamer` ledger so you can trial changes safely before committing them. + +## Highlights + +- Preview every operation with conflict detection before touching the filesystem. +- Share a single set of scope flags (`--path`, `--recursive`, `--include-dirs`, etc.) across all commands. +- Apply literal replacements, substring removals, extension normalization, positional inserts, or regex-driven renames. +- Persist every batch into a `.renamer` ledger and undo the most recent change set at any time. +- Output results in table or plain text formats to fit automation and scripting workflows. + +## Installation + +Prerequisites: Go 1.24+ + +```bash +git clone https://github.com/rogeecn/renamer.git +cd renamer +go install ./... +``` + +The `renamer` binary will be placed in your `GOBIN` (defaults to `$GOPATH/bin`). + +## Usage + +The CLI follows the pattern: + +```bash +renamer [global scope flags] [command args] +``` + +### Shared scope flags + +All subcommands accept these persistent flags: + +- `--path `: Working directory (defaults to current directory). +- `-r, --recursive`: Traverse subdirectories. +- `-d, --include-dirs`: Include directories in results. +- `--hidden`: Include hidden files and directories. +- `-e, --extensions ".jpg|.png"`: Pipe-delimited list of extensions to target. +- `--dry-run`: Force preview-only mode. +- `--yes`: Confirm changes without prompting (mutating commands only). + +### Commands + +- `renamer list [--format table|plain] [--max-depth N]` — Preview the files and directories that match the active scope. +- `renamer replace ` — Replace multiple literal tokens in sequence. Shows duplicates and conflict warnings, then applies when `--yes` is present. +- `renamer remove ` — Strip ordered substrings from names with empty-name protection and duplicate detection. +- `renamer extension ` — Normalize heterogeneous extensions to a single target while keeping a ledger entry for undo. +- `renamer insert ` — Insert text at symbolic (`^`, `$`) or numeric offsets (positive or negative). +- `renamer regex