diff options
| -rw-r--r-- | src/main.rs | 27 | 
1 files changed, 27 insertions, 0 deletions
| diff --git a/src/main.rs b/src/main.rs index dfcdd7b..fb5853c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,6 +49,23 @@ async fn main() {      }  } +fn print_usage() { +    println!(r#" +usage: google-calendar-rsvp [options] [-y | -n | -m] [--email] [event_ids...] + +Options: +    -y, --yes          rsvp with "yes" +    -n, --no           rsvp with "no" +    -m, --maybe        rsvp with "maybe" + +        --email        read a Google Calendar invitation email from stdin + +    -v, --verbose      enable verbose output +    -h, --help         print this help menu +    -V, --version      show the program version +"#); +} +  async fn run() -> anyhow::Result<()> {      let args: Vec<String> = env::args().collect(); @@ -76,6 +93,16 @@ async fn run() -> anyhow::Result<()> {              "-v" | "--verbose" =>                  is_verbose = true, +            "-h" | "--help" => { +                print_usage(); +                process::exit(exitcode::USAGE); +            }, + +            "-V" | "--version" => { +                println!("{}", env!("CARGO_PKG_VERSION")); +                process::exit(exitcode::OK); +            }, +              id =>                  event_ids.push(id),          } | 
