Repository navigation
Quick Start
-
Look before you leap:
sr find "old_api" -p '.py' sr diff "old_api" "new_api" -p '.py'
findshows file:line:col for every occurrence,diffshows the exact unified diff a replace would produce. Neither writes anything. -
Do it:
sr replace "old_api" "new_api" -p '*.py'
The scan phase counts the changes first; if more than 50 files would change you are asked to confirm. Originals are stored in a session under .sr/.
-
Check and, if needed, undo:
git diff # or: sr diff --session latest sr rollback # restores every file of the last session
-
Useful variants:
sr replace "old" "new" --dry-run # count only sr replace "old" "new" --interactive # confirm every hunk sr replace "old" "new" --write=dir -o out # write copies, touch nothing sr replace "old" "new" --json | jq . # machine readable sr replace "old" "new" -C ~/project # another directory
-
Files are skipped for a reason. Add -v to see why:
sr replace "old" "new" -v
You will see "binary content", "ignored by .gitignore", "excluded directory (node_modules)" and so on.
Страница сгенерирована из встроенной справки sr 7.0.1 (sr help <topic>).
Первоисточник — sr/help_system.py; он же питает man sr и sr help --all.
Если страница и вывод sr help расходятся, верить нужно sr help: он всегда
соответствует установленной версии.