Get rid of sample binary

This commit is contained in:
Michael Howell
2021-03-09 11:07:44 -07:00
parent aa339419e3
commit 2e84164d2f
2 changed files with 0 additions and 58 deletions
-3
View File
@@ -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"
-55
View File
@@ -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();
}