Skip to main content

NativeCommand

Trait NativeCommand 

Source
pub trait NativeCommand: Send + Sync {
    // Required methods
    fn command(&self) -> Command;
    fn execute(
        &self,
        args: &[String],
        context: &NativeCommandContext<'_>,
    ) -> Result<NativeCommandOutcome>;

    // Provided methods
    fn auth(&self) -> Option<DescribeCommandAuthV1> { ... }
    fn describe(&self) -> DescribeCommandV1 { ... }
}
Expand description

Trait implemented by in-process commands registered alongside plugins.

Required Methods§

Source

fn command(&self) -> Command

Returns the clap command definition for this command.

Source

fn execute( &self, args: &[String], context: &NativeCommandContext<'_>, ) -> Result<NativeCommandOutcome>

Executes the command using already-parsed argument tokens.

Provided Methods§

Source

fn auth(&self) -> Option<DescribeCommandAuthV1>

Returns optional auth/visibility metadata for the command.

Source

fn describe(&self) -> DescribeCommandV1

Builds the plugin-protocol style description for this command.

Implementors§