More changes to README

This commit is contained in:
Nicolo P 2022-02-15 20:31:42 +01:00
parent cefe4ed764
commit 1785bdd9c0

View File

@ -15,6 +15,8 @@ The command synopsis is very similar to `grep`, although it needs the Python int
python crapgrep.py [OPTIONS] [PATTERN] [FILE[...]] python crapgrep.py [OPTIONS] [PATTERN] [FILE[...]]
``` ```
_**Note**: obviously, `crapgrep` doesn't read from `stdin`, which makes it even more useless..._
## Examples ## Examples
The examples below assume that `python` is an alias of `python3`. The examples below assume that `python` is an alias of `python3`.
@ -35,13 +37,12 @@ python crapgrep.py -i hOlA garbage.txt
### Regexp ### Regexp
**Note**: unlike `grep`, `crapgrep` doesn't treat the string as a regular expression pattern by default, it must be specified by passing the `-E` option expliclty. _**Note**: unlike `grep`, `crapgrep` doesn't treat the string as a regular expression pattern by default, it must be specified by passing the `-E` option explicitly._
Searching for pattern `'^urka[0-9]'` in files `garbage1.txt` and `garbage2.txt` in the parent directory: Searching for pattern `'^urka[0-9]'` in files `garbage1.txt` and `garbage2.txt` in the parent directory:
``` ```
python crapgrep.py -E '^urka[0-9]' ../garbage1.txt ../garbage2.txt python crapgrep.py -E '^urka[0-9]' ../garbage1.txt ../garbage2.txt
``` ```
When multiple files are passed, `crapgrep` will prepend the file name to the matched lines printed to `stdout`. When multiple files are passed, `crapgrep` will prepend the file name to the matched lines printed to `stdout`.
@ -49,8 +50,8 @@ When multiple files are passed, `crapgrep` will prepend the file name to the mat
Considering the example above, the output could be something like: Considering the example above, the output could be something like:
``` ```
garbage1.txt:urka2 paletta ../garbage1.txt:urka2 paletta
garbage2.txt:urka4l8 ../garbage2.txt:urka4l8
``` ```
### Line numbers ### Line numbers
@ -64,12 +65,22 @@ python crapgrep.py -E -n '^urka[0-9]' ../garbage1.txt ../garbage2.txt
could output something like: could output something like:
``` ```
garbage1.txt:5:urka2 paletta ../garbage1.txt:5:urka2 paletta
garbage2.txt:73:urka4l8 ../garbage2.txt:73:urka4l8
``` ```
meaning that the matches were found in lines `5` and `73` of `garbage1.txt` and `garbage2.txt`, respectively. meaning that the matches were found in lines `5` and `73` of `garbage1.txt` and `garbage2.txt`, respectively.
## Text coverage ## Test coverage
Ehm... Ehm...
## Why
If you're asking yourself: "_Why would you inflict something like this upon the world?_", the answer is... because it's fun!
## TODO
- [ ] Implement the recursive search option (`-r`)
- [ ] Implement long options (e.g.,`--ignore-case`)
- [ ] Abandon the project!!