diff --git a/config b/config index 8e3954d..e1ae028 100644 --- a/config +++ b/config @@ -10,6 +10,13 @@ polite=true # Value: int fps=30 + +[format] + +# Date format +# Value: TODO +date=%Y-%m-%d + [styling] # Which color mode to use diff --git a/src/config.rs b/src/config.rs index 2edfd20..b835450 100644 --- a/src/config.rs +++ b/src/config.rs @@ -7,6 +7,7 @@ pub struct Config { pub be_polite: bool, pub fps: u64, pub color: Color, + pub date_format: String, } pub fn load_from_file(path: &str) -> Config { @@ -17,6 +18,7 @@ pub fn load_from_file(path: &str) -> Config { be_polite: ini.getbool("general", "polite").unwrap().unwrap(), fps: ini.getuint("general", "fps").unwrap().unwrap(), color: load_color(&ini), + date_format: ini.get("format", "date").unwrap(), }; return config; diff --git a/src/main.rs b/src/main.rs index ffa3806..128e179 100644 --- a/src/main.rs +++ b/src/main.rs @@ -103,7 +103,10 @@ fn render_frame(config: &Config) -> io::Result<()> { draw_symbol(minute.chars().last().unwrap(), x - 2 + 4 * 7, y, color)?; // Display date - let date = time.date_naive().format("%Y-%m-%d").to_string(); + let date = time + .date_naive() + .format(&config.date_format.to_owned()) + .to_string(); let mut stdout = io::stdout(); let x = width / 2 - (date.len() as u16) / 2;