use {
crate::*,
std::process::ExitStatus,
};
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum CommandStream {
StdOut,
StdErr,
}
#[derive(Debug, Clone)]
pub struct CommandOutputLine {
pub content: TLine,
pub origin: CommandStream,
}
#[derive(Debug, Clone, Default)]
pub struct CommandOutput {
pub lines: Vec<CommandOutputLine>,
}
pub enum CommandExecInfo {
End { status: Option<ExitStatus> },
Interruption,
Error(String),
Line(CommandOutputLine),
}
impl WrappableLine for CommandOutputLine {
fn content(&self) -> &TLine {
&self.content
}
fn prefix_cols(&self) -> usize {
0
}
}
impl CommandOutput {
pub fn reverse(&mut self) {
self.lines.reverse()
}
pub fn push(
&mut self,
line: CommandOutputLine,
) {
self.lines.push(line);
}
pub fn len(&self) -> usize {
self.lines.len()
}
}