CliCommand

Trait CliCommand 

Source
pub trait CliCommand {
    // Provided methods
    fn update_ctx(&self, _matches: &ArgMatches, _ctx: &mut Ctx) -> Result<()> { ... }
    fn run(&self, _ctx: &mut Ctx) -> Result<()> { ... }
    fn next_subcmd<'a>(
        &self,
        _matches: &'a ArgMatches,
    ) -> Option<(Box<dyn CliCommand>, &'a ArgMatches)> { ... }
}

Provided Methods§

Source

fn update_ctx(&self, _matches: &ArgMatches, _ctx: &mut Ctx) -> Result<()>

Care should be taken to keep CliCommand::update_ctx pure with no external effects such as I/O. This allows the CLI to be fully tested without any assumptions of the testing environment

Source

fn run(&self, _ctx: &mut Ctx) -> Result<()>

Source

fn next_subcmd<'a>( &self, _matches: &'a ArgMatches, ) -> Option<(Box<dyn CliCommand>, &'a ArgMatches)>

Implementations§

Source§

impl dyn CliCommand + 'static

Source

pub fn traverse_exec(&self, matches: &ArgMatches, ctx: &mut Ctx) -> Result<()>

Performs three steps:

  • calls self.update_ctx()
  • calls self.run()
  • Gets the next subcommand (if any) by calling self.next_subcmd() and calls traverse_exec on that subcommand.

This walks down the entire used subcommand hierarchy ensuring the update_ctx was called prior to run and that any deeper subcommands were executed.

Source

pub fn traverse_update_ctx( &self, matches: &ArgMatches, ctx: &mut Ctx, ) -> Result<()>

Implementors§

Source§

impl CliCommand for SeaplaneFlight

Source§

impl CliCommand for SeaplaneFlightCopy

Source§

impl CliCommand for SeaplaneFlightDelete

Source§

impl CliCommand for SeaplaneFlightEdit

Source§

impl CliCommand for SeaplaneFlightList

Source§

impl CliCommand for SeaplaneFlightPlan

Source§

impl CliCommand for SeaplaneFormation

Source§

impl CliCommand for SeaplaneFormationDelete

Source§

impl CliCommand for SeaplaneFormationFetch

Source§

impl CliCommand for SeaplaneFormationLand

Source§

impl CliCommand for SeaplaneFormationLaunch

Source§

impl CliCommand for SeaplaneFormationList

Source§

impl CliCommand for SeaplaneFormationPlan

Source§

impl CliCommand for SeaplaneFormationStatus

Source§

impl CliCommand for SeaplaneLocks

Source§

impl CliCommand for SeaplaneLocksAcquire

Source§

impl CliCommand for SeaplaneLocksList

Source§

impl CliCommand for SeaplaneLocksRelease

Source§

impl CliCommand for SeaplaneLocksRenew

Source§

impl CliCommand for SeaplaneMetadata

Source§

impl CliCommand for SeaplaneMetadataDelete

Source§

impl CliCommand for SeaplaneMetadataGet

Source§

impl CliCommand for SeaplaneMetadataList

Source§

impl CliCommand for SeaplaneMetadataSet

Source§

impl CliCommand for SeaplaneRestrict

Source§

impl CliCommand for SeaplaneRestrictDelete

Source§

impl CliCommand for SeaplaneRestrictGet

Source§

impl CliCommand for SeaplaneRestrictList

Source§

impl CliCommand for SeaplaneRestrictSet

Source§

impl CliCommand for SeaplaneAccount

Source§

impl CliCommand for SeaplaneInit

Source§

impl CliCommand for SeaplaneLicense

Source§

impl CliCommand for SeaplaneShellCompletion

Source§

impl CliCommand for Seaplane