diff --git a/src/ics.rs b/src/ics.rs index 9d637fc..a7409d8 100644 --- a/src/ics.rs +++ b/src/ics.rs @@ -5,7 +5,7 @@ use ics::{ Event, ICalendar, Standard, }; -pub fn export(courses: Vec, filename: &str) { +pub fn export(courses: Vec, filename: String) { let mut calendar = ICalendar::new("2.0", "cal8tor"); // Add Europe/Paris timezone @@ -58,7 +58,7 @@ pub fn export(courses: Vec, filename: &str) { } calendar - .save_file(match filename.to_string() { + .save_file(match filename { x if x.ends_with(".ics") => x, x => format!("{}.ics", x), }) diff --git a/src/main.rs b/src/main.rs index 67e1a1b..42cf611 100644 --- a/src/main.rs +++ b/src/main.rs @@ -53,14 +53,14 @@ async fn main() { if args.export.is_some() { // Export the calendar - let filename = args.export.unwrap(); println!("Build the ICS file at {}...", filename); let builded_timetable = timetable::build(timetable, info); - ics::export(builded_timetable, &filename); + ics::export(builded_timetable, filename); } else { // Show the calendar - println!("Displaying...") + println!("Displaying..."); + timetable::display(); } } diff --git a/src/timetable.rs b/src/timetable.rs index 9cd9d94..8be5fb9 100644 --- a/src/timetable.rs +++ b/src/timetable.rs @@ -320,3 +320,8 @@ fn get_semester(semester: Option, letter: Option) -> i8 { }, } } + +/// Display the timetable +pub fn display() { + todo!("WIP") +}