From 1d5bbbd55d2307cd0c50e54e08f1ee632066eefb Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 2 Nov 2019 21:06:35 +0100 Subject: Add a `--help` flag --- src/main.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 8f246b3..12d5725 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,6 +28,7 @@ fn print_usage() { println!(r#"usage: pdf-urls [] FILE Options: + -h, --help print this help menu -v, --version print the program version"#); } @@ -40,6 +41,12 @@ fn main() { process::exit(exitcode::USAGE); } + if args[1] == "-h" || args[1] == "--help" { + print_usage(); + + process::exit(exitcode::OK); + } + if args[1] == "-v" || args[1] == "--version" { println!("{}", VERSION); -- cgit v1.2.3