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,
pub continue_on_failure: bool,
pub requires_success: bool,
}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"
continue_on_failure: false
requires_success: falseFields§
§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.
continue_on_failure: boolWhether the chain continues when this command fails (DD-026).
Governs the chain’s behaviour when this command is one segment of a
multi-command CLI invocation (or a chained run_script() line) and
its handler returns an error:
false(default): stop-on-first-error — identical to today’s single-command exit behaviour, just applied per segment.true: the chain-position error is reported but execution proceeds to the next segment. Intended for genuinely optional steps (e.g. a non-critical secondary export).
Has no effect outside a chain (a single, non-chained command behaves exactly as it does today regardless of this value).
requires_success: boolWhether this command requires every earlier command in the chain to have succeeded before it is allowed to run (DD-026).
Not to be confused with Self::required, which is an unrelated,
startup-time check (“a handler must be registered for this
command”) — requires_success is a per-invocation, chain-position
concern evaluated at dispatch time, and only observable downstream
of an earlier command whose own continue_on_failure is true
(otherwise the chain has already stopped by the time this command
would run).
false(default): runs regardless of any earlier failure in the chain (moot under the default stop-on-first policy).true: if any earlier command in the chain has already failed (tracked via a runningchain_has_failureflag, regardless of that failure’s owncontinue_on_failurevalue), this command is skipped — not executed, not counted as an additional failure — and reported distinctly from a chain-position error.
Trait Implementations§
Source§impl Clone for CommandDefinition
impl Clone for CommandDefinition
Source§fn clone(&self) -> CommandDefinition
fn clone(&self) -> CommandDefinition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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>,
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 UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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