Skip to main content

CommandDefinition

Struct CommandDefinition 

Source
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: false

Fields§

§name: String

Command name (used for invocation)

§aliases: Vec<String>

Alternative names for the command

§description: String

Human-readable description for help text

§required: bool

Whether 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: String

Name of the handler implementation

This string is used to match the command with its registered handler in the CommandRegistry.

§continue_on_failure: bool

Whether 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: bool

Whether 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 running chain_has_failure flag, regardless of that failure’s own continue_on_failure value), 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

Source§

fn clone(&self) -> CommandDefinition

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CommandDefinition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CommandDefinition

Source§

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

Source§

fn eq(&self, other: &CommandDefinition) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for CommandDefinition

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for CommandDefinition

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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.