1.7 KiB
1.7 KiB
Regex Command Scenario Fixtures
This directory provides ready-to-run datasets for validating the renamer regex
command against realistic workflows. Copy a scenario to a temporary directory
before mutating files so the repository remains clean:
TMP_DIR=$(mktemp -d)
cp -R testdata/regex/capture-groups/* "$TMP_DIR/"
go run ./main.go regex '^(\w+)-(\d+)$' '@2_@1' --dry-run --path "$TMP_DIR"
Structure
regex/
├── capture-groups/
│ ├── alpha-123.log
│ ├── beta-456.log
│ ├── gamma-789.log
│ └── notes.txt
├── automation/
│ ├── build_101_release.tar.gz
│ ├── build_102_hotfix.tar.gz
│ ├── build_103_varchive/
│ │ └── placeholder.txt
│ └── feature-demo_2025-10-01.txt
└── validation/
├── duplicate-a-01.txt
├── duplicate-b-01.txt
└── group-miss.txt
Scenario Highlights
- capture-groups – Mirrors the quickstart preview example. Run with
renamer regex '^(\w+)-(\d+)$' '@2_@1' --dry-runto verify captured groups swap safely while non-matching files remain untouched. - automation – Supports end-to-end
--yesapplies and undo. Userenamer regex '^(feature)-(.*)$' '@2-@1' --yesto exercise ledger writes andrenamer regex '^(build)_(\d+)_v(.*)$' 'release-@2-@1-v@3'to combine extension filtering with directory handling. - validation – Surfaces error cases. Applying
renamer regex '^(duplicate)-(.*)-(\d+)$' '@1-@3' --yesshould report a duplicate-target conflict, while referencing@2withrenamer regex '^(.+)$' '@2' --dry-runraises an undefined group error.
Extend these fixtures as new edge cases or regression scenarios arise.