CommandManager

Struct CommandManager 

Source
pub struct CommandManager { /* private fields */ }
Expand description

High-level command manager for executing and managing commands

Implementations§

Source§

impl CommandManager

Source

pub fn new(registry: CommandRegistry) -> Self

Create a new command manager

Source

pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>

Create a command manager from a config file

Source

pub fn set_output_config(&mut self, config: OutputInjectionConfig)

Set the output injection configuration

Source

pub fn output_config(&self) -> &OutputInjectionConfig

Get the output injection configuration

Source

pub fn registry(&self) -> &CommandRegistry

Get the registry

Source

pub fn registry_mut(&mut self) -> &mut CommandRegistry

Get a mutable reference to the registry

Source

pub fn execute( &self, command_id: &str, arguments: HashMap<String, String>, cwd: String, ) -> Result<CommandExecutionResult>

Execute a command by ID

Source

pub fn execute_and_inject( &self, command_id: &str, arguments: HashMap<String, String>, cwd: String, ) -> Result<String>

Execute a command and get injected output

Source

pub fn list_commands(&self) -> Vec<CommandDefinition>

List all commands

Source

pub fn list_enabled_commands(&self) -> Vec<CommandDefinition>

List enabled commands

Source

pub fn get_command(&self, command_id: &str) -> Result<CommandDefinition>

Get command details

Source

pub fn search_commands(&self, query: &str) -> Vec<CommandDefinition>

Search for commands

Source

pub fn find_commands_by_tag(&self, tag: &str) -> Vec<CommandDefinition>

Find commands by tag

Source

pub fn register_command(&mut self, command: CommandDefinition) -> Result<()>

Register a new command

Source

pub fn unregister_command(&mut self, command_id: &str) -> Result<()>

Unregister a command

Source

pub fn enable_command(&mut self, command_id: &str) -> Result<()>

Enable a command

Source

pub fn disable_command(&mut self, command_id: &str) -> Result<()>

Disable a command

Source

pub fn save_to_file<P: AsRef<Path>>(&self, path: P) -> Result<()>

Save commands to a file

Source

pub fn reload_from_file<P: AsRef<Path>>(&mut self, path: P) -> Result<()>

Reload commands from a file

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.