feat: print usage when running patch without args (#124)

This commit is contained in:
Eric Seidel
2024-05-07 13:13:25 -07:00
committed by GitHub
parent 7361089102
commit caaa14c124
+17
View File
@@ -11,6 +11,23 @@ use std::time::Instant;
fn main() {
let mut args = std::env::args();
if args.len() < 4 {
eprintln!(
"Usage: {} <base> <new> <output>",
std::path::Path::new(&args.next().unwrap())
.file_name()
.unwrap()
.to_str()
.unwrap()
);
eprintln!(" base: Path to the base file");
eprintln!(" new: Path to the new file");
eprintln!(" output: Path to the output patch file");
eprintln!("");
eprintln!(" This is an internal tool for creating binary diffs.");
std::process::exit(1);
}
args.next(); // skip program name
let older = args.next().expect("path to base file");
let newer = args.next().expect("path to new file");