dircmp

Crates.iodircmp
lib.rsdircmp
version0.2.0
sourcesrc
created_at2022-11-29 12:07:28.703594
updated_at2022-11-29 13:10:01.461151
descriptionCompare folders and return a diff for assertion
homepage
repositoryhttps://github.com/jondot/dircmp
max_upload_size
id725317
size15,054
Dotan J. Nahum (jondot)

documentation

https://docs.rs/dircmp/

README

dircmp

github crates.io docs.rs build status

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

[dependencies]
dircmp = "0.1.0"

Usage

Default usage:

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

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

Ignore components:

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. See LICENSE for further details.

Commit count: 3

cargo fmt