Skip to main content

sandbox_quant/terminal/
app.rs

1use crate::terminal::completion::ShellCompletion;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4pub enum TerminalMode {
5    Raw,
6    Line,
7}
8
9pub enum TerminalEvent {
10    NoOutput,
11    Output(String),
12    Exit,
13}
14
15pub trait TerminalApp {
16    fn terminal_mode(&self) -> TerminalMode {
17        TerminalMode::Raw
18    }
19    fn intro_panel(&self) -> String;
20    fn help_heading(&self) -> &'static str {
21        "slash commands"
22    }
23    fn help_text(&self) -> String;
24    fn prompt(&self) -> String;
25    fn complete(&self, line: &str) -> Vec<ShellCompletion>;
26    fn execute_line(&mut self, line: &str) -> Result<TerminalEvent, String>;
27}