pub enum ScriptCommand {
WriteText {
text: String,
},
Notify {
title: String,
body: String,
},
SetBadge {
text: String,
},
SetVariable {
name: String,
value: String,
},
RunCommand {
command: String,
},
ChangeConfig {
key: String,
value: Value,
},
Log {
level: String,
message: String,
},
SetPanel {
title: String,
content: String,
},
ClearPanel {},
}Expand description
A command sent from a script subprocess to the terminal (via stdout).
Tagged with type for easy JSON dispatch.
Variants§
WriteText
Write text to the PTY.
Notify
Show a desktop notification.
SetBadge
Set the tab badge text.
SetVariable
Set a user variable.
RunCommand
Execute a shell command.
ChangeConfig
Change a configuration value.
Log
Log a message.
Fields
SetPanel
Set a markdown panel.
ClearPanel
Clear the markdown panel.
Implementations§
Source§impl ScriptCommand
impl ScriptCommand
Sourcepub fn requires_permission(&self) -> bool
pub fn requires_permission(&self) -> bool
Returns true if this command requires explicit permission in the script config.
Commands that return true must have their corresponding allow_* flag set
in ScriptConfig before the dispatcher will execute them.
§Security Classification
| Command | Requires Permission | Risk Level |
|---|---|---|
Log | No | Low (UI output only) |
SetPanel / ClearPanel | No | Low (UI display only) |
Notify | No | Low (desktop notification) |
SetBadge | No | Low (tab badge display) |
SetVariable | No | Low (user variable storage) |
WriteText | Yes | High (PTY injection, command execution) |
RunCommand | Yes | Critical (arbitrary process spawn) |
ChangeConfig | Yes | High (config modification) |
Sourcepub fn permission_flag_name(&self) -> Option<&'static str>
pub fn permission_flag_name(&self) -> Option<&'static str>
Returns the name of the permission flag required to execute this command.
Returns None for commands that don’t require permission.
The returned string corresponds to a field in ScriptConfig:
"allow_run_command"forRunCommand"allow_write_text"forWriteText"allow_change_config"forChangeConfig
Sourcepub fn is_rate_limited(&self) -> bool
pub fn is_rate_limited(&self) -> bool
Returns true if this command can safely be executed without rate limiting.
Commands that may be emitted frequently (like Log) should not be rate-limited
to avoid dropping important debug output. High-impact commands (WriteText,
RunCommand) must be rate-limited to prevent abuse.
Sourcepub fn command_name(&self) -> &'static str
pub fn command_name(&self) -> &'static str
Returns a human-readable name for this command type (for logging/errors).
Trait Implementations§
Source§impl Clone for ScriptCommand
impl Clone for ScriptCommand
Source§fn clone(&self) -> ScriptCommand
fn clone(&self) -> ScriptCommand
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScriptCommand
impl Debug for ScriptCommand
Source§impl<'de> Deserialize<'de> for ScriptCommand
impl<'de> Deserialize<'de> for ScriptCommand
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ScriptCommand
impl PartialEq for ScriptCommand
Source§impl Serialize for ScriptCommand
impl Serialize for ScriptCommand
impl StructuralPartialEq for ScriptCommand
Auto Trait Implementations§
impl Freeze for ScriptCommand
impl RefUnwindSafe for ScriptCommand
impl Send for ScriptCommand
impl Sync for ScriptCommand
impl Unpin for ScriptCommand
impl UnsafeUnpin for ScriptCommand
impl UnwindSafe for ScriptCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more