Help command

This commit is contained in:
Greg Shuflin committed 2024-03-04 01:49:08 -08:00
1 parent 496fb4f3fd
commit 0ca7a345d2
3 files changed
+7

No files matched your search

+3
View File
@@ -143,6 +143,9 @@ impl EditorCore {
error!(err, "Command Output Error");
}
CommandOutput::WriteBuffer(path) => log_only(self.write_current_buffer(path)),
CommandOutput::ShowHelp => {
info!("TODO show help");
}
};
self.handle_action(EditorAction::TransitionToMode(Mode::Normal));
+1
View File
@@ -13,6 +13,7 @@ pub(crate) enum CommandOutput {
WriteBuffer(Option<PathBuf>),
Quit,
Error(String),
ShowHelp,
}
#[derive(Debug)]
+3
View File
@@ -15,6 +15,7 @@ impl CommandAPI {
Some(s) if s == "open" => Command::Open,
Some(s) if s == "quit" || s == "q" => Command::Quit,
Some(s) if s == "write" || s == "w" => Command::Write,
Some(s) if s == "help" || s == "h" => Command::Help,
Some(other) => return Some(CommandOutput::Error(format!("Invalid command: {other}"))),
None => return None,
};
@@ -33,6 +34,7 @@ impl CommandAPI {
Some(CommandOutput::OpenFile(path))
}
Command::Quit => Some(CommandOutput::Quit),
Command::Help => Some(CommandOutput::ShowHelp),
}
}
}
@@ -42,4 +44,5 @@ enum Command {
Open,
Quit,
Write,
Help,
}