diff options
Diffstat (limited to 'src/command.rs')
-rw-r--r-- | src/command.rs | 10 |
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)] | ||
19 | pub enum Command { | 29 | pub 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, |