pub struct BashExecutionComponent { /* private fields */ }Expand description
Component that displays a bash command execution with streaming output.
Implementations§
Source§impl BashExecutionComponent
impl BashExecutionComponent
Sourcepub fn new(command: impl Into<String>) -> Self
pub fn new(command: impl Into<String>) -> Self
Create a new component for the given command (without the leading $).
Sourcepub fn new_excluded(command: impl Into<String>) -> Self
pub fn new_excluded(command: impl Into<String>) -> Self
Create a component whose command is excluded from the model context
(the !! prefix). Renders with the dim border/header color.
Sourcepub fn new_with_context(
command: impl Into<String>,
exclude_from_context: bool,
) -> Self
pub fn new_with_context( command: impl Into<String>, exclude_from_context: bool, ) -> Self
Shared constructor. exclude_from_context selects the dim color key.
Sourcepub fn set_exclude_from_context(&self, exclude: bool)
pub fn set_exclude_from_context(&self, exclude: bool)
Set whether this command is excluded from the model context. The border and header recolor on the next render.
Sourcepub fn is_excluded_from_context(&self) -> bool
pub fn is_excluded_from_context(&self) -> bool
Whether this command is excluded from the model context.
Sourcepub fn set_command(&self, command: &str)
pub fn set_command(&self, command: &str)
Apply the authoritative command from ToolExecutionStart. A panel may
have been created from an earlier streaming snapshot, so this must
replace a partial command as well as an empty one.
Sourcepub fn append_output(&self, chunk: &str)
pub fn append_output(&self, chunk: &str)
Replace the displayed output with the latest streamed snapshot.
The bash tool’s on_update contract sends the complete captured output
so far, not a delta. Appending each update duplicated all prior lines
(a, then a\nb became aa\nb). Keep the latest snapshot instead.
Sourcepub fn set_complete(
&self,
exit_code: Option<i32>,
cancelled: bool,
truncation: BashTruncation,
)
pub fn set_complete( &self, exit_code: Option<i32>, cancelled: bool, truncation: BashTruncation, )
Mark execution complete.
Sourcepub fn set_expanded(&self, expanded: bool)
pub fn set_expanded(&self, expanded: bool)
Toggle expanded (full output) vs collapsed (preview) display.
Sourcepub fn is_expanded(&self) -> bool
pub fn is_expanded(&self) -> bool
Whether currently expanded.
Sourcepub fn get_output(&self) -> String
pub fn get_output(&self) -> String
Get the raw joined output.