Skip to content

Latest commit

 

History

History
97 lines (64 loc) · 3.48 KB

README.md

File metadata and controls

97 lines (64 loc) · 3.48 KB

pjgrep - A Simple Pattern Search Tool for Files and Directories

pjgrep is a fast and flexible pattern searching tool designed to search for specific patterns within files and directories. It supports searching for patterns in filenames and file contents and allows you to filter by file extensions. This tool is lightweight, highly customizable, and works cross-platform.

Features

  • Search for patterns in file names and file content.
  • Support for filtering files by extension (e.g., .txt, .md, .rs).
  • Provides counts for how many times a pattern appears in the content.
  • Color-coded output for better readability.
  • Cross-platform support (Linux, macOS, Windows).
  • Fast search through directories and subdirectories.

Installation

To use pjgrep, you need to have Rust installed. You can install it using the following steps:

  1. Install Rust (if not already installed):

    • Follow the instructions on the official Rust installation page.
    • On most systems, you can install it via the following command:
      curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2. Clone the Repository: Clone this repository to your local machine:

    git clone https://github.com/rezkhaleghi/pj-grep.git
    cd pj-grep
  3. Build the Project: Build the pjgrep application with the following command:

    cargo build --release
  4. Install the Binary: Optionally, you can copy the binary to a directory in your $PATH (e.g., /usr/local/bin or ~/bin) for easy access:

    sudo cp target/release/pjgrep /usr/local/bin/pjgrep

Usage

pjgrep <pattern> [directory] [--format=<ext1,ext2,...>]
  • <pattern>: The pattern to search for.
  • [directory]: The directory to search in (optional, defaults to the current directory).
  • [--format=<txt,json,ts,env,...>]: A comma-separated list of file extensions to filter by (optional).

Examples

Search for a pattern in the current directory

pjgrep "example"

Search for a pattern in a specific directory

pjgrep "example" /path/to/directory

Search for a pattern in files with specific extensions

pjgrep "example" /path/to/directory --format=rs,txt,md

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

Author

Created and maintained by "PocketJack (Rez Khaleghi)"

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

pj-grep