An I/O PRoject: Building a Command Line Program1
To run the program:
$ cargo run --bin cli-program <QUERY> <FILE_PATH>
Compiling cli-program v0.1.0 ...
To run the tests:
$ cargo test --package cli-program --lib -- tests --nocapture
running X tests
This project is a recreation of the command-line tool, grep
(globally
search a regular expression and print). It takes as arguments:
- a file path
- a string
... then it reads the file, finds files that contain the string, and prints those lines.
This project will use:
stderr
andstdout
- organizing code
- vectors and strings
- handling errors
- using traits and lifetimes
- writing tests
... and briefly introduce closures, iterators, and trait objects.