From b1adad35197eea58a81bbad6ce68510d13df664a Mon Sep 17 00:00:00 2001 From: Mylloon Date: Wed, 17 Aug 2022 14:56:36 +0200 Subject: [PATCH] improve cli --- src/main.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index 39433a7..24a5d17 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use clap::{Parser}; +use clap::Parser; use regex::Regex; mod ics; @@ -9,16 +9,16 @@ mod utils; #[derive(Parser)] #[clap(version, about, long_about = None)] struct Args { - /// The class you want to get the timetable + /// The class you want to get the timetable, i.e.: L2-A #[clap(value_parser)] class: String, - /// The semester you want (useful only in 3rd year) - #[clap(short, long, value_parser)] + /// The semester you want (useful only in 3rd year, 1-2 use letter in class) + #[clap(short, long, value_parser, value_name = "SEMESTER NUMBER")] semester: Option, /// Export to iCalendar format (.ics) - #[clap(short, long)] + #[clap(short, long, value_name = "FILE NAME")] export: Option, } @@ -53,10 +53,12 @@ async fn main() { if args.export.is_some() { // Export the calendar - println!("Build the ICS file..."); - let builded_timetable = timetable::build(timetable, info); - ics::export(builded_timetable, &args.export.unwrap()); + let filename = args.export.unwrap(); + println!("Build the ICS file at {}...", filename); + + let builded_timetable = timetable::build(timetable, info); + ics::export(builded_timetable, &filename); } else { // Show the calendar println!("Displaying...")