rs-dot-ignore 0.1.0

A Rust library and CLI utility for **efficient directory walking with `.ignore`-style file exclusion** โ€” inspired by `.gitignore` behavior.
Documentation
  • Coverage
  • 58.33%
    7 out of 12 items documented1 out of 7 items with examples
  • Size
  • Source code size: 12.5 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 382.12 kB This is the summed size of all files generated by rustdoc for all configured targets
  • ร˜ build duration
  • this release: 19s Average build duration of successful builds.
  • all releases: 19s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ghost_333612

rs-dot-ignore

Crates.io License

A Rust library and CLI utility for efficient directory walking with .ignore-style file exclusion โ€” inspired by .gitignore behavior.


๐Ÿš€ Overview

rs-dot-ignore provides a flexible and extendable way to recursively walk directories while respecting ignore rules scoped per directory, just like .gitignore. It supports:

  • Per-directory .ignore files with scoped rules
  • Powerful glob-based pattern matching
  • Support for relative and recursive ignore patterns
  • Easily customizable callback for processing matched files/directories

Whether youโ€™re building a file watcher, backup tool, or any utility that needs fine-grained file filtering, rs-dot-ignore gives you the control you need.


โš™๏ธ Features

  • Mimics .gitignore scoped ignore behavior, supporting patterns like:
    • /target to ignore a folder only in the current scope
    • **/node_modules to ignore recursively everywhere
    • Relative patterns like ./build
  • Efficient in-memory caching of ignore rules per directory
  • Recursive walking with user-defined callback to process files/directories
  • Easily extensible to support advanced features like negation and layered ignore files

๐Ÿ“ฆ Installation

Add rs-dot-ignore to your Cargo.toml:

[dependencies]

rs-dot-ignore = "0.1"


๐Ÿ›  Usage

Example usage:

use rs_dot_ignore::walk_dir;

fn main() {
    let base_dir = std::env::current_dir().unwrap();

    walk_dir(base_dir.to_str().unwrap(), |entry| {
        let path = entry.path();
        if path.is_dir() {
            println!("Dir: {}", path.display());
        } else {
            println!("File: {}", path.display());
        }
    });
}

๐Ÿค Contributing

Iโ€™m excited to grow this project into a fast, robust, and fully featured .ignore implementation.

If you want to contribute, your help is welcome with:

  • Optimizations and performance improvements
  • Supporting .ignore features like negation (!pattern)
  • Adding tests and examples
  • Bug fixes and documentation enhancements

Feel free to open issues or submit pull requests!


๐Ÿ”ฎ Roadmap

  • Improve pattern parsing and add full .gitignore feature support
  • Optimize performance with incremental parsing and caching
  • Add CLI tool for standalone usage
  • Support multi-platform path handling and Windows-style paths