From 188827f3548ea8ca1ab84735b8fe19f99c790207 Mon Sep 17 00:00:00 2001 From: Akshay Date: Fri, 10 Jul 2020 21:51:37 +0530 Subject: redo quit command --- src/command.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/command.rs') 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) { s.call_on_name("Main", |view: &mut App| { view.parse_command(input); }); + + // special command that requires access to + // our main cursive object, has to be parsed again + // here + // TODO: fix this somehow + if Command::from_string(input) == Command::Quit { + s.quit(); + } + s.pop_layer(); } +#[derive(PartialEq)] pub enum Command { Add(String, String, Option), // habit name, habit type, optional goal MonthPrev, -- cgit v1.2.3