diff options
author | Teddy Wing | 2019-11-02 20:48:40 +0100 |
---|---|---|
committer | Teddy Wing | 2019-11-02 20:57:38 +0100 |
commit | eb2f9c78a4698ccc2d09e5021fbf7155e49f561d (patch) | |
tree | d62e55fc2ac69cb08b066e66bff599f3e4739d62 /src | |
parent | f0e87f4e91bc60a7ab86dcd9819368082c102b82 (diff) | |
download | pdf-urls-eb2f9c78a4698ccc2d09e5021fbf7155e49f561d.tar.bz2 |
Add a `--version` flag
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index 9c1fd97..8f246b3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,8 +22,13 @@ use std::process; use pdf_urls::get_urls_from_pdf; +const VERSION: &'static str = "0.0.1"; + fn print_usage() { - println!("usage: pdf-urls FILE"); + println!(r#"usage: pdf-urls [<options>] FILE + +Options: + -v, --version print the program version"#); } fn main() { @@ -35,6 +40,12 @@ fn main() { process::exit(exitcode::USAGE); } + if args[1] == "-v" || args[1] == "--version" { + println!("{}", VERSION); + + process::exit(exitcode::OK); + } + match get_urls_from_pdf(&args[1]) { Ok(urls) => { for url in urls { |