diff options
author | Akshay <[email protected]> | 2020-07-14 12:50:36 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2020-07-14 12:50:36 +0100 |
commit | 3ded40d04f49983e7907366536dbc94917cee666 (patch) | |
tree | 5e837246e3603249c9a7e4343d1afb762d5d0e71 /src/app.rs | |
parent | 68ebbd1f753e0937bfaf07006daf1d6144c21bed (diff) |
more boilerplate for auto-trackable habits
add funding.yml also :^)
Diffstat (limited to 'src/app.rs')
-rw-r--r-- | src/app.rs | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -190,11 +190,15 @@ impl App { | |||
190 | pub fn parse_command(&mut self, input: &str) { | 190 | pub fn parse_command(&mut self, input: &str) { |
191 | let c = Command::from_string(input); | 191 | let c = Command::from_string(input); |
192 | match c { | 192 | match c { |
193 | Command::Add(name, kind, goal) => { | 193 | Command::Add(name, kind, goal, auto) => { |
194 | if kind == "count" { | 194 | if kind == "count" { |
195 | self.add_habit(Box::new(Count::new(name, goal.unwrap_or(0)))); | 195 | self.add_habit(Box::new(Count::new( |
196 | name, | ||
197 | goal.unwrap_or(0), | ||
198 | auto.unwrap_or(false), | ||
199 | ))); | ||
196 | } else if kind == "bit" { | 200 | } else if kind == "bit" { |
197 | self.add_habit(Box::new(Bit::new(name))); | 201 | self.add_habit(Box::new(Bit::new(name, auto.unwrap_or(false)))); |
198 | } | 202 | } |
199 | } | 203 | } |
200 | Command::Delete(name) => { | 204 | Command::Delete(name) => { |