aboutsummaryrefslogtreecommitdiff
path: root/src/command.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-07-14 12:50:36 +0100
committerAkshay <[email protected]>2020-07-14 12:50:36 +0100
commit3ded40d04f49983e7907366536dbc94917cee666 (patch)
tree5e837246e3603249c9a7e4343d1afb762d5d0e71 /src/command.rs
parent68ebbd1f753e0937bfaf07006daf1d6144c21bed (diff)
more boilerplate for auto-trackable habits
add funding.yml also :^)
Diffstat (limited to 'src/command.rs')
-rw-r--r--src/command.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/command.rs b/src/command.rs
index afc00ba..c1a855e 100644
--- a/src/command.rs
+++ b/src/command.rs
@@ -27,7 +27,7 @@ fn call_on_app(s: &mut Cursive, input: &str) {
27 27
28#[derive(PartialEq)] 28#[derive(PartialEq)]
29pub enum Command { 29pub enum Command {
30 Add(String, String, Option<u32>), // habit name, habit type, optional goal 30 Add(String, String, Option<u32>, Option<bool>), // habit name, habit type, optional goal, auto tracked
31 MonthPrev, 31 MonthPrev,
32 MonthNext, 32 MonthNext,
33 Delete(String), 33 Delete(String),
@@ -50,10 +50,12 @@ impl Command {
50 return Command::Blank; 50 return Command::Blank;
51 } 51 }
52 let goal = args.get(2).map(|g| g.parse::<u32>().ok()).flatten(); 52 let goal = args.get(2).map(|g| g.parse::<u32>().ok()).flatten();
53 let auto = args.get(3).map(|g| g.parse::<bool>().ok()).flatten();
53 return Command::Add( 54 return Command::Add(
54 args.get_mut(0).unwrap().to_string(), 55 args.get_mut(0).unwrap().to_string(),
55 args.get_mut(1).unwrap().to_string(), 56 args.get_mut(1).unwrap().to_string(),
56 goal, 57 goal,
58 auto,
57 ); 59 );
58 } 60 }
59 "delete" | "d" => { 61 "delete" | "d" => {