summaryrefslogtreecommitdiffstats
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] = &[
"quit",
"write",
"help",
+ "writeandquit",
];
fn get_command_completion(prefix: &str) -> Option<String> {
@@ -98,8 +99,9 @@ fn call_on_app(s: &mut Cursive, input: &str) {
// our main cursive object, has to be parsed again
// here
// TODO: fix this somehow
- if let Ok(Command::Quit) = Command::from_string(input) {
- s.quit();
+ match Command::from_string(input) {
+ Ok(Command::Quit) | Ok(Command::WriteAndQuit) => s.quit(),
+ _ => {}
}
}
@@ -115,6 +117,7 @@ pub enum Command {
Write,
Quit,
Blank,
+ WriteAndQuit,
}
#[derive(Debug)]
@@ -196,6 +199,7 @@ impl Command {
}
"mprev" | "month-prev" => return Ok(Command::MonthPrev),
"mnext" | "month-next" => return Ok(Command::MonthNext),
+ "wq" | "writeandquit" => return Ok(Command::WriteAndQuit),
"q" | "quit" => return Ok(Command::Quit),
"w" | "write" => return Ok(Command::Write),
"" => return Ok(Command::Blank),