From 2e84164d2fad48c42595c91782d01da0a776bcd6 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Tue, 9 Mar 2021 11:07:44 -0700 Subject: [PATCH] Get rid of sample binary --- Cargo.toml | 3 --- src/main.rs | 55 ----------------------------------------------------- 2 files changed, 58 deletions(-) delete mode 100644 src/main.rs diff --git a/Cargo.toml b/Cargo.toml index c57521d..5b2d07f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,5 @@ license = "MIT OR Apache-2.0" repository = "https://github.com/notriddle/rust-unified-diff" exclude = [ "fuzz" ] -[[bin]] -name = "unified-diff" - [dependencies] diff = "0.1.10" diff --git a/src/main.rs b/src/main.rs deleted file mode 100644 index 16ff8e2..0000000 --- a/src/main.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Sample program. Do not use. -use std::env; -use std::fs; -use std::io::{self, Write}; -use std::process; -fn main() { - let mut o = env::args_os(); - // parse CLI - let exe = match o.next() { - Some(from) => from, - None => { - eprintln!("Usage: [exe] [from] [to]"); - process::exit(1); - } - }; - let from = match o.next() { - Some(from) => from, - None => { - eprintln!("Usage: {} [from] [to]", exe.to_string_lossy()); - process::exit(1); - } - }; - let to = match o.next() { - Some(from) => from, - None => { - eprintln!("Usage: {} [from] [to]", exe.to_string_lossy()); - process::exit(1); - } - }; - // read files - let from_content = match fs::read(&from) { - Ok(from_content) => from_content, - Err(e) => { - eprintln!("Failed to read from-file: {}", e); - process::exit(2); - } - }; - let to_content = match fs::read(&to) { - Ok(to_content) => to_content, - Err(e) => { - eprintln!("Failed to read to-file: {}", e); - process::exit(2); - } - }; - // run diff - io::stdout() - .write_all(&unified_diff::diff( - &from_content, - &from.to_string_lossy(), - &to_content, - &to.to_string_lossy(), - 1, - )) - .unwrap(); -}