parent
759787023f
commit
d0ac3cd517
2 changed files with 9 additions and 1 deletions
|
|
@ -66,6 +66,11 @@ impl Course {
|
||||||
&self.semesters
|
&self.semesters
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get a reference to the course's semesters.
|
||||||
|
pub fn semesters_mut(&mut self) -> &mut Vec<String> {
|
||||||
|
&mut self.semesters
|
||||||
|
}
|
||||||
|
|
||||||
/// Check if course is part of current semester
|
/// Check if course is part of current semester
|
||||||
pub fn is_current(&self) -> bool {
|
pub fn is_current(&self) -> bool {
|
||||||
self.semesters()
|
self.semesters()
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,10 @@ fn main() -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add(course: Course, debug: bool) -> Result<()> {
|
fn add(mut course: Course, debug: bool) -> Result<()> {
|
||||||
|
if course.semesters().is_empty() {
|
||||||
|
course.semesters_mut().push(util::get_current_semester())
|
||||||
|
}
|
||||||
let toml = toml::to_string(&course)?;
|
let toml = toml::to_string(&course)?;
|
||||||
println!("{}", toml);
|
println!("{}", toml);
|
||||||
let target_dir = [
|
let target_dir = [
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue