pub mod builtins;
pub mod classifier;
mod dispatch;
pub mod exec;
pub mod expand;
mod io;
pub mod parser;
mod pty;
mod redirect;
mod terminal;
pub use dispatch::{execute, try_builtin};
#[derive(Debug, Clone, PartialEq)]
pub enum LoopAction {
Continue,
Exit,
}
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub struct CommandResult {
pub stdout: String,
pub stderr: String,
pub exit_code: i32,
pub action: LoopAction,
pub used_alt_screen: bool,
}
impl CommandResult {
pub fn success(stdout: String) -> Self {
Self {
stdout,
stderr: String::new(),
exit_code: 0,
action: LoopAction::Continue,
used_alt_screen: false,
}
}
pub fn error(stderr: String, exit_code: i32) -> Self {
Self {
stdout: String::new(),
stderr,
exit_code,
action: LoopAction::Continue,
used_alt_screen: false,
}
}
pub fn exit_with(exit_code: i32) -> Self {
Self {
stdout: String::new(),
stderr: String::new(),
exit_code,
action: LoopAction::Exit,
used_alt_screen: false,
}
}
}