From 6c29f02527358a81737b1086dc490f288edfb799 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 17 Feb 2024 17:05:51 +0100 Subject: [PATCH] improve the readme and example --- README.md | 91 ++++++++++++++++++++++++------------------------------- 1 file changed, 40 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index aef5bdd..c99770f 100644 --- a/README.md +++ b/README.md @@ -7,59 +7,48 @@ The goal of this package is to be a dropped in replacement for the [diffutils commands](https://www.gnu.org/software/diffutils/) in Rust. - Based on the incomplete diff generator in https://github.com/rust-lang/rust/blob/master/src/tools/compiletest/src/runtest.rs, and made to be compatible with GNU's diff and patch tools. + +## Installation + +Ensure you have Rust installed on your system. You can install Rust through [rustup](https://rustup.rs/). + +Clone the repository and build the project using Cargo: + +```bash +git clone https://github.com/uutils/diffutils.git +cd diffutils +cargo build --release ``` -~/diffutils$ cargo run -- diff -u3 Cargo.lock Cargo.toml + +```bash + +cat <fruits_old.txt +Apple +Banana +Cherry +EOF + +cat <fruits_new.txt +Apple +Fig +Cherry +EOF + +$ cargo run -- -u fruits_old.txt fruits_new.txt Finished dev [unoptimized + debuginfo] target(s) in 0.00s - Running `target/debug/diff -u3 Cargo.lock Cargo.toml` ---- Cargo.lock -+++ Cargo.toml -@@ -1,39 +1,7 @@ --# This file is automatically @generated by Cargo. --# It is not intended for manual editing. --version = 3 -- --[[package]] --name = "context-diff" --version = "0.1.0" --dependencies = [ -- "diff 0.1.12", --] -- --[[package]] --name = "diff" --version = "0.1.0" --dependencies = [ -- "context-diff", -- "normal-diff", -- "unified-diff", --] -- --[[package]] --name = "diff" --version = "0.1.12" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499" -- --[[package]] --name = "normal-diff" --version = "0.1.0" --dependencies = [ -- "diff 0.1.12", --] -- --[[package]] --name = "unified-diff" --version = "0.3.0" --dependencies = [ -- "diff 0.1.12", -+[workspace] -+members = [ -+ "lib/unified-diff", -+ "lib/context-diff", -+ "lib/normal-diff", -+ "bin/diff", - ] + Running `target/debug/diffutils -u fruits_old.txt fruits_new.txt` +--- fruits_old.txt ++++ fruits_new.txt +@@ -1,3 +1,3 @@ + Apple +-Banana ++Fig + Cherry + ``` + +## License + +diffutils is licensed under the MIT and Apache Licenses - see the `LICENSE-MIT` or `LICENSE-APACHE` files for details