aboutsummaryrefslogtreecommitdiff
path: root/src/command.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/command.rs')
-rw-r--r--src/command.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/command.rs b/src/command.rs
index 4f3e491..30aabe2 100644
--- a/src/command.rs
+++ b/src/command.rs
@@ -20,6 +20,7 @@ static COMMANDS: &'static [&'static str] = &[
20 "quit", 20 "quit",
21 "write", 21 "write",
22 "help", 22 "help",
23 "writeandquit",
23]; 24];
24 25
25fn get_command_completion(prefix: &str) -> Option<String> { 26fn get_command_completion(prefix: &str) -> Option<String> {
@@ -98,8 +99,9 @@ fn call_on_app(s: &mut Cursive, input: &str) {
98 // our main cursive object, has to be parsed again 99 // our main cursive object, has to be parsed again
99 // here 100 // here
100 // TODO: fix this somehow 101 // TODO: fix this somehow
101 if let Ok(Command::Quit) = Command::from_string(input) { 102 match Command::from_string(input) {
102 s.quit(); 103 Ok(Command::Quit) | Ok(Command::WriteAndQuit) => s.quit(),
104 _ => {}
103 } 105 }
104} 106}
105 107
@@ -115,6 +117,7 @@ pub enum Command {
115 Write, 117 Write,
116 Quit, 118 Quit,
117 Blank, 119 Blank,
120 WriteAndQuit,
118} 121}
119 122
120#[derive(Debug)] 123#[derive(Debug)]
@@ -196,6 +199,7 @@ impl Command {
196 } 199 }
197 "mprev" | "month-prev" => return Ok(Command::MonthPrev), 200 "mprev" | "month-prev" => return Ok(Command::MonthPrev),
198 "mnext" | "month-next" => return Ok(Command::MonthNext), 201 "mnext" | "month-next" => return Ok(Command::MonthNext),
202 "wq" | "writeandquit" => return Ok(Command::WriteAndQuit),
199 "q" | "quit" => return Ok(Command::Quit), 203 "q" | "quit" => return Ok(Command::Quit),
200 "w" | "write" => return Ok(Command::Write), 204 "w" | "write" => return Ok(Command::Write),
201 "" => return Ok(Command::Blank), 205 "" => return Ok(Command::Blank),