aboutsummaryrefslogtreecommitdiff
path: root/src/command.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-07-10 17:21:37 +0100
committerAkshay <[email protected]>2020-07-10 17:21:37 +0100
commit188827f3548ea8ca1ab84735b8fe19f99c790207 (patch)
tree70e4803b0538fda181de2de7430fb3f6c9707fb6 /src/command.rs
parentf156defd5b1a7e38b8f98e6df3135b288ac61722 (diff)
redo quit command
Diffstat (limited to 'src/command.rs')
-rw-r--r--src/command.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/command.rs b/src/command.rs
index d25608f..afc00ba 100644
--- a/src/command.rs
+++ b/src/command.rs
@@ -13,9 +13,19 @@ fn call_on_app(s: &mut Cursive, input: &str) {
13 s.call_on_name("Main", |view: &mut App| { 13 s.call_on_name("Main", |view: &mut App| {
14 view.parse_command(input); 14 view.parse_command(input);
15 }); 15 });
16
17 // special command that requires access to
18 // our main cursive object, has to be parsed again
19 // here
20 // TODO: fix this somehow
21 if Command::from_string(input) == Command::Quit {
22 s.quit();
23 }
24
16 s.pop_layer(); 25 s.pop_layer();
17} 26}
18 27
28#[derive(PartialEq)]
19pub enum Command { 29pub enum Command {
20 Add(String, String, Option<u32>), // habit name, habit type, optional goal 30 Add(String, String, Option<u32>), // habit name, habit type, optional goal
21 MonthPrev, 31 MonthPrev,