Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jondot/dircmp

📖 Compare two folders for the similarities and differences
https://github.com/jondot/dircmp

assert rust rust-lang testing

Last synced: about 2 months ago
JSON representation

📖 Compare two folders for the similarities and differences

Awesome Lists containing this project

README

        

# dircmp

[github](https://github.com/jondot/dircmp)
[crates.io](https://crates.io/crates/dircmp)
[docs.rs](https://docs.rs/dircmp)
[build status](https://github.com/jondot/dircmp/actions?query=branch%3Amaster)

Compare two folders for the similarities and differences.

* Two way comparison
* File types (dir, symlink, etc.)
* Content difference is based on hashing the files, so binaries are also good for comparison
* Good for asserting in tests and for taking snapshot of difference or similarity

# Dependency

```toml
[dependencies]
dircmp = "0.1.0"
```

# Usage

Default usage:

```rust
let cmp = dircmp::Comparison::default();

let result = cmp
.compare(
Path::new("/tmp/a"),
Path::new("/tmp/b"),
)
```

Ignore components:

```rust
use regex::RegexSet;

let ignores = let set = RegexSet::new(&[
r"foo",
r"bar",
]).expect("should compile");

let cmp = dircmp::Comparison::new(ignores);

let result = cmp
.compare(
Path::new("/tmp/a"),
Path::new("/tmp/b"),
)
```

# Copyright

Copyright (c) 2022 [@jondot](http://twitter.com/jondot). See [LICENSE](LICENSE.txt) for further details.