pub struct CommandManager { /* private fields */ }Expand description
High-level command manager for executing and managing commands
Implementations§
Source§impl CommandManager
impl CommandManager
Sourcepub fn new(registry: CommandRegistry) -> Self
pub fn new(registry: CommandRegistry) -> Self
Create a new command manager
Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>
Create a command manager from a config file
Sourcepub fn set_output_config(&mut self, config: OutputInjectionConfig)
pub fn set_output_config(&mut self, config: OutputInjectionConfig)
Set the output injection configuration
Sourcepub fn output_config(&self) -> &OutputInjectionConfig
pub fn output_config(&self) -> &OutputInjectionConfig
Get the output injection configuration
Sourcepub fn registry(&self) -> &CommandRegistry
pub fn registry(&self) -> &CommandRegistry
Get the registry
Sourcepub fn registry_mut(&mut self) -> &mut CommandRegistry
pub fn registry_mut(&mut self) -> &mut CommandRegistry
Get a mutable reference to the registry
Sourcepub fn execute(
&self,
command_id: &str,
arguments: HashMap<String, String>,
cwd: String,
) -> Result<CommandExecutionResult>
pub fn execute( &self, command_id: &str, arguments: HashMap<String, String>, cwd: String, ) -> Result<CommandExecutionResult>
Execute a command by ID
Sourcepub fn execute_and_inject(
&self,
command_id: &str,
arguments: HashMap<String, String>,
cwd: String,
) -> Result<String>
pub fn execute_and_inject( &self, command_id: &str, arguments: HashMap<String, String>, cwd: String, ) -> Result<String>
Execute a command and get injected output
Sourcepub fn list_commands(&self) -> Vec<CommandDefinition>
pub fn list_commands(&self) -> Vec<CommandDefinition>
List all commands
Sourcepub fn list_enabled_commands(&self) -> Vec<CommandDefinition>
pub fn list_enabled_commands(&self) -> Vec<CommandDefinition>
List enabled commands
Sourcepub fn get_command(&self, command_id: &str) -> Result<CommandDefinition>
pub fn get_command(&self, command_id: &str) -> Result<CommandDefinition>
Get command details
Sourcepub fn search_commands(&self, query: &str) -> Vec<CommandDefinition>
pub fn search_commands(&self, query: &str) -> Vec<CommandDefinition>
Search for commands
Sourcepub fn find_commands_by_tag(&self, tag: &str) -> Vec<CommandDefinition>
pub fn find_commands_by_tag(&self, tag: &str) -> Vec<CommandDefinition>
Find commands by tag
Sourcepub fn register_command(&mut self, command: CommandDefinition) -> Result<()>
pub fn register_command(&mut self, command: CommandDefinition) -> Result<()>
Register a new command
Sourcepub fn unregister_command(&mut self, command_id: &str) -> Result<()>
pub fn unregister_command(&mut self, command_id: &str) -> Result<()>
Unregister a command
Sourcepub fn enable_command(&mut self, command_id: &str) -> Result<()>
pub fn enable_command(&mut self, command_id: &str) -> Result<()>
Enable a command
Sourcepub fn disable_command(&mut self, command_id: &str) -> Result<()>
pub fn disable_command(&mut self, command_id: &str) -> Result<()>
Disable a command
Auto Trait Implementations§
impl Freeze for CommandManager
impl RefUnwindSafe for CommandManager
impl Send for CommandManager
impl Sync for CommandManager
impl Unpin for CommandManager
impl UnwindSafe for CommandManager
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
Mutably borrows from an owned value. Read more