Skip to content

Commit

Permalink
feat: print usage when running patch without args (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
eseidel authored May 7, 2024
1 parent 7361089 commit caaa14c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions patch/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit caaa14c

Please sign in to comment.