2 releases
0.1.1 | Jan 30, 2023 |
---|---|
0.1.0 | Jan 29, 2023 |
#91 in #demo
12KB
A command line application in Rust
- This is a tool where we can give a string and a path, and it will print only the lines containing the given string.
- I distributed it with cargo in this link.
- We are able to run the tool like this:
$ cat test.txt
apple 1
bee 2
cat 3
dog 4
apple 5
$ grrs_hj apple test.txt
apple 1
apple 5
project setup
- Clone the repo:
git clone https://github.com/JuliaJHL/week2-rust-mini-proj.git
- cd into the repo:
cd week2-rust-mini-proj
- compile the project:
cargo build --release
- run the project:
cargo run -- xxx(pattern) xxx(path)
examples:
I created a test.txt with the following contents:
apple 1
bee 2
cat 3
dog 4
apple 5
When we apply cargo run -- apple test.txt
, it would only return:
apple 1
apple 5
Distributing with cargo
I made package info updates in Cargo.toml
and pushlished it via:
cargo login
cargo publish
Therefore, you can install grrs_hj
and run it without cloning the repo by implementing the following commands directly:
cargo install grrs_hj
grrs_hj xxx(pattern) xxx(path)
Here is an example:
References
Dependencies
~8–18MB
~254K SLoC