pub struct CommandDefinition {
pub name: String,
pub aliases: Vec<String>,
pub description: String,
pub required: bool,
pub arguments: Vec<ArgumentDefinition>,
pub options: Vec<OptionDefinition>,
pub implementation: String,
}Expand description
Definition of a single command
Describes a command with its arguments, options, and validation rules. Each command must have a corresponding handler implementation.
§Example
name: simulate
aliases: [sim, run]
description: "Run a simulation"
required: true
arguments:
- name: input_file
arg_type: path
required: true
description: "Input configuration file"
validation:
- must_exist: true
- extensions: [yaml, json]
options: []
implementation: "simulate_handler"Fields§
§name: StringCommand name (used for invocation)
aliases: Vec<String>Alternative names for the command
description: StringHuman-readable description for help text
required: boolWhether this command is required to be implemented
If true, the application will fail to start if no handler is registered.
arguments: Vec<ArgumentDefinition>Positional arguments
options: Vec<OptionDefinition>Named options (flags)
implementation: StringName of the handler implementation
This string is used to match the command with its registered handler in the CommandRegistry.
Trait Implementations§
Source§impl Clone for CommandDefinition
impl Clone for CommandDefinition
Source§fn clone(&self) -> CommandDefinition
fn clone(&self) -> CommandDefinition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CommandDefinition
impl Debug for CommandDefinition
Source§impl<'de> Deserialize<'de> for CommandDefinition
impl<'de> Deserialize<'de> for CommandDefinition
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for CommandDefinition
impl PartialEq for CommandDefinition
Source§impl Serialize for CommandDefinition
impl Serialize for CommandDefinition
impl StructuralPartialEq for CommandDefinition
Auto Trait Implementations§
impl Freeze for CommandDefinition
impl RefUnwindSafe for CommandDefinition
impl Send for CommandDefinition
impl Sync for CommandDefinition
impl Unpin for CommandDefinition
impl UnwindSafe for CommandDefinition
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