pub struct CustomCommandRegistry { /* private fields */ }Expand description
In-memory registry of all custom commands discovered from global + project-level directories. Project commands override global ones when names collide (loaded second).
Implementations§
Source§impl CustomCommandRegistry
impl CustomCommandRegistry
Sourcepub fn load(project_root: &Path) -> Self
pub fn load(project_root: &Path) -> Self
Scan both global ($ATOMCODE_HOME/commands/) and project-level
(<project_root>/.atomcode/commands/) directories, merging results.
Project entries win on name collision.
Sourcepub fn empty() -> Self
pub fn empty() -> Self
An empty registry — useful for tests or when custom commands are disabled.
Sourcepub fn get(&self, name: &str) -> Option<&CustomCommand>
pub fn get(&self, name: &str) -> Option<&CustomCommand>
Look up a command by name.
Sourcepub fn render(&self, name: &str, args: &str) -> Option<String>
pub fn render(&self, name: &str, args: &str) -> Option<String>
Render the template for name, replacing $ARGUMENTS /
${ARGUMENTS} with the provided args string.
Sourcepub fn list(&self) -> Vec<&CustomCommand>
pub fn list(&self) -> Vec<&CustomCommand>
All commands, sorted by name.
Sourcepub fn command_names_and_descriptions(&self) -> Vec<(String, String)>
pub fn command_names_and_descriptions(&self) -> Vec<(String, String)>
(name, description) pairs for every registered custom command,
sorted by name. Convenient for feeding into completion / menu builders.
Auto Trait Implementations§
impl Freeze for CustomCommandRegistry
impl RefUnwindSafe for CustomCommandRegistry
impl Send for CustomCommandRegistry
impl Sync for CustomCommandRegistry
impl Unpin for CustomCommandRegistry
impl UnsafeUnpin for CustomCommandRegistry
impl UnwindSafe for CustomCommandRegistry
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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