pub trait Command<Ctx>: 'static {
// Required methods
fn name(&self) -> &str;
fn help(&self) -> &str;
fn run(
&mut self,
args: &[&str],
ctx: &mut Ctx,
out: &mut ConsoleWriter,
) -> Result<()>;
// Provided methods
fn long_help(&self) -> String { ... }
fn arg_choices(&self, arg_index: usize) -> &[&'static str] { ... }
fn arg_choices_ctx<'a>(
&'a self,
arg_index: usize,
prior: &[&str],
) -> &'a [&'static str] { ... }
fn arg_value_choices(&self, arg_index: usize, key: &str) -> &[&'static str] { ... }
fn arg_value_choices_ctx<'a>(
&'a self,
arg_index: usize,
key: &str,
prior: &[&str],
) -> &'a [&'static str] { ... }
}Required Methods§
Provided Methods§
fn arg_choices(&self, arg_index: usize) -> &[&'static str]
Sourcefn arg_choices_ctx<'a>(
&'a self,
arg_index: usize,
prior: &[&str],
) -> &'a [&'static str]
fn arg_choices_ctx<'a>( &'a self, arg_index: usize, prior: &[&str], ) -> &'a [&'static str]
prior is the arg tokens before the cursor.
Sourcefn arg_value_choices(&self, arg_index: usize, key: &str) -> &[&'static str]
fn arg_value_choices(&self, arg_index: usize, key: &str) -> &[&'static str]
key carries no trailing =; empty means free-form.