Giter Club home page Giter Club logo

minigrep-rust's Introduction

Minigrep implementation in Rust

Far inferior to grep command, but still it returns lines from a file containing your query string, both case strictly and flexibly by passing a flag in argument.

Requirements

Clap dependency has been added in the Cargo.toml file already. It provides neat Command Line Argument Parsing, which is essentially its full-form. 😊

Usage

git clone link-to-repo
cd minigrep_rust
cargo run -- --help
My Own Rust CLI MiniGrep! 
Gurbaaz Singh Nandra <gurbaaz27.github.io>
Returns the lines in file containing your query.

USAGE:
    minigrep_rust --case_sensitive <case_sensitive> --filename <filename> --query <query>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -c, --case_sensitive <case_sensitive>    Whether the search be case-insensitive(n) or sensitive(y). [default: y]
    -f, --filename <filename>                String of filename(with extension) you want to search in.
    -q, --query <query>                      String you want to search in the file.

A "poem.txt" document has been added as sample file in root directory.

Example usage (Ubuntu 18.04)

➜  minigrep_rust git:(master) ✗ cargo run -- --query the --filename poem.txt --case_sensitive n
   Compiling minigrep_rust v0.1.0 (/home/gurbaaz/rprojects/minigrep_rust)
    Finished dev [unoptimized + debuginfo] target(s) in 0.60s
     Running `target/debug/minigrep_rust --query the --filename poem.txt --case_sensitive n`
Then there’s a pair of us - don’t tell!
They’d banish us, you know.
To tell your name the livelong day

Do star if you liked it or learnt something, and please 🙏 give suggestions for improvement, as working with Rust is surely rusty 😵(definitely for learners).

❤️

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.