pub struct CommandSummary {
pub id: CommandId,
pub command_line: String,
pub cwd_uri: Option<String>,
pub status: CommandStatus,
pub exit_code: Option<i32>,
pub signal: Option<i32>,
pub duration_ms: Option<u64>,
pub output_start_line: u64,
pub output_end_line: Option<u64>,
pub diagnostic_count: usize,
pub error_count: usize,
pub warning_count: usize,
}Expand description
Redacted command lifecycle and diagnostic counts for a snapshot.
Counts are computed only from the diagnostic slice supplied to
Self::from_command. diagnostic_count includes all severities;
error_count and warning_count are severity-specific subsets.
§Examples
use ailloli_ui_terminal_core::{
CommandExecution, CommandId, CommandStatus, CommandSummary, TerminalRedactionPolicy,
};
let command = CommandExecution::running(CommandId(7), "token=abc", None, 3, Some(10));
let summary = CommandSummary::from_command(
&command,
&[],
&TerminalRedactionPolicy::default(),
);
assert_eq!(summary.status, CommandStatus::Running);
assert_eq!(summary.command_line, "token=[redacted]");Fields§
§id: CommandIdShell-state-local command identity.
command_line: StringRedacted command line.
cwd_uri: Option<String>Redacted working-directory URI, or None when unknown.
status: CommandStatusLifecycle outcome at capture time.
exit_code: Option<i32>Signed exit code, or None when absent.
signal: Option<i32>Signed signal number, or None when absent.
duration_ms: Option<u64>Duration in milliseconds, or None when unavailable.
output_start_line: u64Inclusive first global output line.
output_end_line: Option<u64>Inclusive last global output line, or None while open/unknown.
diagnostic_count: usizeNumber of supplied diagnostics whose command_id exactly matches.
error_count: usizeNumber of matching error diagnostics.
warning_count: usizeNumber of matching warning diagnostics.
Implementations§
Source§impl CommandSummary
impl CommandSummary
Sourcepub fn from_command(
command: &CommandExecution,
diagnostics: &[TerminalDiagnostic],
redaction: &TerminalRedactionPolicy,
) -> Self
pub fn from_command( command: &CommandExecution, diagnostics: &[TerminalDiagnostic], redaction: &TerminalRedactionPolicy, ) -> Self
Builds a redacted summary and counts matching diagnostics.
Diagnostics with command_id == None or another identity are ignored.
The diagnostics themselves are not returned or redacted here. Count
increments use ordinary usize arithmetic; exceeding usize::MAX would
panic with overflow checks and wrap otherwise, although such a slice
cannot be represented in practice.
§Examples
use ailloli_ui_terminal_core::{
CommandExecution, CommandId, CommandSummary, TerminalRedactionPolicy,
};
let command = CommandExecution::running(CommandId(2), "echo ok", None, 9, None);
let summary = CommandSummary::from_command(
&command,
&[],
&TerminalRedactionPolicy::disabled(),
);
assert_eq!(summary.id, CommandId(2));
assert_eq!(summary.output_start_line, 9);
assert_eq!(summary.diagnostic_count, 0);Trait Implementations§
Source§impl Clone for CommandSummary
impl Clone for CommandSummary
Source§fn clone(&self) -> CommandSummary
fn clone(&self) -> CommandSummary
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more