aboutsummaryrefslogtreecommitdiff
path: root/src/habit
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-07-15 11:00:52 +0100
committerAkshay <[email protected]>2020-07-15 11:00:52 +0100
commit99d2a835b4f032de78d9cdbe27521363a25204bd (patch)
tree2d9a275dc4269679f47e929603e924c6ba648646 /src/habit
parent3ded40d04f49983e7907366536dbc94917cee666 (diff)
display view mode in statusline
Diffstat (limited to 'src/habit')
-rw-r--r--src/habit/prelude.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/habit/prelude.rs b/src/habit/prelude.rs
index b8b2bb2..19b00a7 100644
--- a/src/habit/prelude.rs
+++ b/src/habit/prelude.rs
@@ -1,4 +1,6 @@
1use serde::{Deserialize, Serialize}; 1use serde::{Deserialize, Serialize};
2use std::default;
3use std::fmt;
2 4
3pub enum TrackEvent { 5pub enum TrackEvent {
4 Increment, 6 Increment,
@@ -13,12 +15,23 @@ pub enum ViewMode {
13 Year, 15 Year,
14} 16}
15 17
16impl std::default::Default for ViewMode { 18impl default::Default for ViewMode {
17 fn default() -> Self { 19 fn default() -> Self {
18 ViewMode::Day 20 ViewMode::Day
19 } 21 }
20} 22}
21 23
24impl fmt::Display for ViewMode {
25 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26 match self {
27 ViewMode::Day => write!(f, "DAY"),
28 ViewMode::Week => write!(f, "WEEK"),
29 ViewMode::Month => write!(f, "MONTH"),
30 ViewMode::Year => write!(f, "YEAR"),
31 }
32 }
33}
34
22pub fn default_auto() -> bool { 35pub fn default_auto() -> bool {
23 false 36 false
24} 37}