diff options
| -rw-r--r-- | doc/pdf-urls.1 | 5 | ||||
| -rw-r--r-- | doc/pdf-urls.1.txt | 3 | ||||
| -rw-r--r-- | src/main.rs | 7 | 
3 files changed, 15 insertions, 0 deletions
| diff --git a/doc/pdf-urls.1 b/doc/pdf-urls.1 index 3e90edc..7554d45 100644 --- a/doc/pdf-urls.1 +++ b/doc/pdf-urls.1 @@ -37,6 +37,11 @@ pdf-urls \- Extract URLs from a PDF file  Extract all URLs from a PDF file and print them, one per line, to standard output\&.  .SH "OPTIONS"  .PP +\-h, \-\-help +.RS 4 +Print usage help\&. +.RE +.PP  \-v, \-\-version  .RS 4  Print the program version\&. diff --git a/doc/pdf-urls.1.txt b/doc/pdf-urls.1.txt index ddc2048..294a98f 100644 --- a/doc/pdf-urls.1.txt +++ b/doc/pdf-urls.1.txt @@ -16,6 +16,9 @@ standard output.  OPTIONS  ------- +-h, --help:: +	Print usage help. +  -v, --version::  	Print the program version. 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 [<options>] 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); | 
