3 releases (1 stable)

1.0.0 Sep 8, 2023
0.1.1 Aug 2, 2023
0.1.0 Aug 1, 2023

#2430 in Command line utilities

48 downloads per month

MIT license

13KB
222 lines

build version version_downloades License

Introduction

This is a small implementation of grep command line tool in rust (see References). From version 1.0.0 onwards regular expressions or regex is also supported. For complete implementation of grep in rust, check ripgrep.

Installation

For running or installing graby, install rust. To add graby run the following cargo command in your project directory:

cargo add graby

or manually add following in Cargo.toml file.

graby = "1.0.0" # graby = "version"

To build graby from source you need to install rust on your device and run the following commands:

git clone https://github.com/Raghav-Bell/graby.git
cd graby
cargo run -- --help

or you can also build it from released binaries.

Usage

For searching QUERY pattern in FILE_PATH use following command:

graby --q QUERY --f FILE_PATH

For more options run

graby --help

Usage: graby.exe [OPTIONS] --query <QUERY> --file-path <FILE_PATH>

Options:
  -q, --query <QUERY>          Pattern to search in the file
  -r, --regex-match            Take pattern as regular expression
  -f, --file-path <FILE_PATH>  Path to the file
  -i, --ignore-case            Ignore case distinctions while searching QUERY in FILE_PATH
  -v, --invert-match           Print the lines without QUERY pattern in the FILE_PATH
  -h, --help                   Print help
  -V, --version                Print version

or check documentation.
It is licensed under MIT.

How to Contribute

All small or large contributions are welcomed .

References

ch-12 rust-lang book, Command Line Applications in Rust

Dependencies

~3.5–5MB
~90K SLoC