Struct CliRunner

Source
pub struct CliRunner<'a> { /* private fields */ }
Expand description

CLI command builder and runner.

Implementations§

Source§

impl<'a> CliRunner<'a>

Source

pub fn init() -> Self

Initializes CLI environment and returns a builder. This should be called as early as possible.

Source

pub fn name(self, name: &str) -> Self

Set the name of the CLI application to be displayed in help messages.

Source

pub fn about(self, about: &str) -> Self

Set the about message to be displayed in help messages.

Source

pub fn version(self, version: &str) -> Self

Set the version to be displayed by jj version.

Source

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.

Source

pub fn add_extra_config_migration(self, rule: ConfigMigrationRule) -> Self

Adds config migration rule in addition to the default rules.

Source

pub fn add_store_factories(self, store_factories: StoreFactories) -> Self

Adds StoreFactories to be used.

Source

pub fn add_working_copy_factories( self, working_copy_factories: WorkingCopyFactories, ) -> Self

Adds working copy factories to be used.

Source

pub fn set_workspace_loader_factory( self, workspace_loader_factory: Box<dyn WorkspaceLoaderFactory>, ) -> Self

Source

pub fn add_symbol_resolver_extension( self, symbol_resolver: Box<dyn SymbolResolverExtension>, ) -> Self

Source

pub fn add_revset_function_extension( self, name: &'static str, func: RevsetFunction, ) -> Self

Source

pub fn add_commit_template_extension( self, commit_template_extension: Box<dyn CommitTemplateLanguageExtension>, ) -> Self

Source

pub fn add_operation_template_extension( self, operation_template_extension: Box<dyn OperationTemplateLanguageExtension>, ) -> Self

Source

pub fn add_dispatch_hook<F>(self, dispatch_hook_fn: F) -> Self
where F: FnOnce(&mut Ui, &CommandHelper, CliDispatchFn<'_>) -> Result<(), CommandError> + 'a,

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.

Source

pub fn add_subcommand<C, F>(self, custom_dispatch_fn: F) -> Self
where C: Subcommand, F: FnOnce(&mut Ui, &CommandHelper, C) -> Result<(), CommandError> + 'a,

Registers new subcommands in addition to the default ones.

Source

pub fn add_global_args<A, F>(self, process_before: F) -> Self
where A: Args, F: FnOnce(&mut Ui, A) -> Result<(), CommandError> + 'a,

Registers new global arguments in addition to the default ones.

Source

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,