A clone of grep, simpler, slower and without unit testing (for the moment).
Check out the wiki if you want to dive deeper into... stuff :)
As mentioned in multiple places in this repo, this app was created following the guide.
However, this version includes piping support (reading from stdin), meaning that the input file flag is optional. It also implements a Buffered Reader instead of loading the entire file (or stdin) into memory at once.
Note: Using a Buffered Reader has a drawback, which is that you are creating a copy of the input, and processing it later.
Note II: it also uses a Buffered output, which can cause performance issues as discussed in the performance analysis.
-
Colored output, with an optional flag. -
Multiple patterns - Doing the much needed optimizations
- Multi-threading
- Add a debug or verbose flag(?) but I don't know what it should output
Straight from grepclone -h
:
grepclone 0.2.0
Just a simple grep clone programmed in Rust.
grepclone takes either an input file (`-i` option) or reads the stdin if no file is passed as an argument.
USAGE:
grepclone [FLAGS] [OPTIONS] [patterns]...
FLAGS:
-c, --color Wether to print with colored output or not
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-i, --input <input> Input file (Optional)
ARGS:
<patterns>... Pattern(s) to search for. Required parameter
I used the amazing and wonderful "cross" cargo program to cross-compile the program to windows. Can't compile for Mac because I don't own one :) blame Apple.
Check the detailed explanation and analysis in the wiki.
TL;DR: They do byte manipulations and program at a lower level, as well as being smarter xD.
It would be really cool, and a good learning experience, BUT!
Multithreading comes with certain overhead, meaning that it is only worth using for really large tasks. So the program would need to check the size of the input(?) and then use multithreading (single-threading otherwise).