https://github.com/jaimebuelta/replace
Replace text in directories
https://github.com/jaimebuelta/replace
cli python text-replace
Last synced: 11 months ago
JSON representation
Replace text in directories
- Host: GitHub
- URL: https://github.com/jaimebuelta/replace
- Owner: jaimebuelta
- License: mit
- Created: 2016-10-27T22:12:29.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-10-27T22:28:15.000Z (over 9 years ago)
- Last Synced: 2024-10-18T14:10:37.982Z (over 1 year ago)
- Topics: cli, python, text-replace
- Language: Python
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# replace
Replace text in directories
A command line tool to replace text easily and recursively in directories
Usage
-----
python replace.py [-h] [dir] input_file output_file
It replaces the content of input_file with the content of output_file,
respecting the indentation level in all the files in `dir`.
For example, for
*input_file*
self.assertRaises(Error, call, param1, param2)
*output_file*
with self.assertRaises():
call(param1, param2)
it will replace occurrences of input for output in all files
Limitations
-----------
- Works only with full lines
- Very early development
- For more syntax aware refactors, take a look at undebt (http://undebt.readthedocs.io/en/latest/)
- Only indentation with spaces, no tabs
To Dos
------
- More tests
- Properly packetize it and make a script
- Use parse (https://github.com/r1chardj0n3s/parse) to allow better control
over replacement, it will probably be never super awesome, but will add tons
of flexibility
- Maye unify the input and output files to replace