From 44846562bed43699e3f82c145ce175120a4b1c19 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 16 Aug 2022 23:40:42 +0200 Subject: [PATCH] wip cli --- src/main.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 96435ee..ae90595 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,29 @@ +use clap::Parser; + mod ics; mod info; mod timetable; mod utils; +#[derive(Parser)] +#[clap(version, about, long_about = None)] +struct Args { + /// Class + #[clap(short, long, value_parser)] + class: i8, + + /// Subgroup if you have one, for example in `L1-A`, specify here the `A` + #[clap(short, long, value_parser)] + letter: Option, +} + #[tokio::main] async fn main() { - println!("Fetch the timetable..."); + let args = Args::parse(); + + println!("class: L{}{}", args.class, args.letter.unwrap_or_default()); + + /* println!("Fetch the timetable..."); let timetable = timetable::timetable(3, 1, None).await; println!("Fetch informations about the year..."); @@ -14,5 +32,5 @@ async fn main() { println!("Build the ICS file..."); let builded_timetable = timetable::build(timetable, info); - ics::export(builded_timetable, "target/debug.ics"); + ics::export(builded_timetable, "target/debug.ics"); */ }