* use String instead of &str
* WIP display fn
This commit is contained in:
parent
076ed15d2a
commit
829b4ef7b1
3 changed files with 10 additions and 5 deletions
|
@ -5,7 +5,7 @@ use ics::{
|
||||||
Event, ICalendar, Standard,
|
Event, ICalendar, Standard,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn export(courses: Vec<crate::timetable::models::Course>, filename: &str) {
|
pub fn export(courses: Vec<crate::timetable::models::Course>, filename: String) {
|
||||||
let mut calendar = ICalendar::new("2.0", "cal8tor");
|
let mut calendar = ICalendar::new("2.0", "cal8tor");
|
||||||
|
|
||||||
// Add Europe/Paris timezone
|
// Add Europe/Paris timezone
|
||||||
|
@ -58,7 +58,7 @@ pub fn export(courses: Vec<crate::timetable::models::Course>, filename: &str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
calendar
|
calendar
|
||||||
.save_file(match filename.to_string() {
|
.save_file(match filename {
|
||||||
x if x.ends_with(".ics") => x,
|
x if x.ends_with(".ics") => x,
|
||||||
x => format!("{}.ics", x),
|
x => format!("{}.ics", x),
|
||||||
})
|
})
|
||||||
|
|
|
@ -53,14 +53,14 @@ async fn main() {
|
||||||
|
|
||||||
if args.export.is_some() {
|
if args.export.is_some() {
|
||||||
// Export the calendar
|
// Export the calendar
|
||||||
|
|
||||||
let filename = args.export.unwrap();
|
let filename = args.export.unwrap();
|
||||||
println!("Build the ICS file at {}...", filename);
|
println!("Build the ICS file at {}...", filename);
|
||||||
|
|
||||||
let builded_timetable = timetable::build(timetable, info);
|
let builded_timetable = timetable::build(timetable, info);
|
||||||
ics::export(builded_timetable, &filename);
|
ics::export(builded_timetable, filename);
|
||||||
} else {
|
} else {
|
||||||
// Show the calendar
|
// Show the calendar
|
||||||
println!("Displaying...")
|
println!("Displaying...");
|
||||||
|
timetable::display();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,3 +320,8 @@ fn get_semester(semester: Option<i8>, letter: Option<char>) -> i8 {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Display the timetable
|
||||||
|
pub fn display() {
|
||||||
|
todo!("WIP")
|
||||||
|
}
|
||||||
|
|
Reference in a new issue