pub struct CliRunner<'a> { /* private fields */ }
Expand description
CLI command builder and runner.
Implementations§
Source§impl<'a> CliRunner<'a>
impl<'a> CliRunner<'a>
Sourcepub fn init() -> Self
pub fn init() -> Self
Initializes CLI environment and returns a builder. This should be called as early as possible.
Sourcepub fn name(self, name: &str) -> Self
pub fn name(self, name: &str) -> Self
Set the name of the CLI application to be displayed in help messages.
Sourcepub fn about(self, about: &str) -> Self
pub fn about(self, about: &str) -> Self
Set the about message to be displayed in help messages.
Sourcepub fn add_extra_config(self, layer: ConfigLayer) -> Self
pub fn add_extra_config(self, layer: ConfigLayer) -> Self
Adds default configs in addition to the normal defaults.
The layer.source
must be Default
. Other sources such as User
would
be replaced by loaded configuration.
Sourcepub fn add_extra_config_migration(self, rule: ConfigMigrationRule) -> Self
pub fn add_extra_config_migration(self, rule: ConfigMigrationRule) -> Self
Adds config migration rule in addition to the default rules.
Sourcepub fn add_store_factories(self, store_factories: StoreFactories) -> Self
pub fn add_store_factories(self, store_factories: StoreFactories) -> Self
Adds StoreFactories
to be used.
Sourcepub fn add_working_copy_factories(
self,
working_copy_factories: WorkingCopyFactories,
) -> Self
pub fn add_working_copy_factories( self, working_copy_factories: WorkingCopyFactories, ) -> Self
Adds working copy factories to be used.
pub fn set_workspace_loader_factory( self, workspace_loader_factory: Box<dyn WorkspaceLoaderFactory>, ) -> Self
pub fn add_symbol_resolver_extension( self, symbol_resolver: Box<dyn SymbolResolverExtension>, ) -> Self
pub fn add_revset_function_extension( self, name: &'static str, func: RevsetFunction, ) -> Self
pub fn add_commit_template_extension( self, commit_template_extension: Box<dyn CommitTemplateLanguageExtension>, ) -> Self
pub fn add_operation_template_extension( self, operation_template_extension: Box<dyn OperationTemplateLanguageExtension>, ) -> Self
Sourcepub fn add_dispatch_hook<F>(self, dispatch_hook_fn: F) -> Self
pub fn add_dispatch_hook<F>(self, dispatch_hook_fn: F) -> Self
Add a hook that gets called when it’s time to run the command. It is the hook’s responsibility to call the given inner dispatch function to run the command.
Sourcepub fn add_subcommand<C, F>(self, custom_dispatch_fn: F) -> Self
pub fn add_subcommand<C, F>(self, custom_dispatch_fn: F) -> Self
Registers new subcommands in addition to the default ones.
Sourcepub fn add_global_args<A, F>(self, process_before: F) -> Self
pub fn add_global_args<A, F>(self, process_before: F) -> Self
Registers new global arguments in addition to the default ones.
pub fn run(self) -> u8
Auto Trait Implementations§
impl<'a> Freeze for CliRunner<'a>
impl<'a> !RefUnwindSafe for CliRunner<'a>
impl<'a> !Send for CliRunner<'a>
impl<'a> !Sync for CliRunner<'a>
impl<'a> Unpin for CliRunner<'a>
impl<'a> !UnwindSafe for CliRunner<'a>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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