Struct clapcmd::ClapCmdBuilder

source ·
pub struct ClapCmdBuilder<State = ()> { /* private fields */ }
Expand description

The ClapCmdBuilder is mostly a thin wrapper around the rustyline builder that allows you to specify how to interact with the readline interface. The main difference is that the default options for the ClapCmdBuilder includes auto_add_history

Implementations§

source§

impl<State> ClapCmdBuilder<State>

source

pub fn build(&self) -> ClapCmd<State>where State: Clone + Send + Sync + 'static,

Used to complete the build a return a ClapCmd struct

source

pub fn state(self, state: Option<State>) -> Self

Specify the starting state for the builder

source

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

Specify the “about” string displayed in the help menu

source

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

Specify the default prompt, this can later be altered using the set_prompt() method

source

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

Specify the default continuation prompt (for multiline input), this can later be altered using the set_continuation_prompt() method

source

pub fn without_help(self) -> Self

Do not add the default ‘help’ command to the repl

source

pub fn without_exit(self) -> Self

Do not add the default ‘exit’ command to the repl

Trait Implementations§

source§

impl<State: Clone> Clone for ClapCmdBuilder<State>

source§

fn clone(&self) -> ClapCmdBuilder<State>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<State> Configurer for ClapCmdBuilder<State>

source§

fn config_mut(&mut self) -> &mut Config

Config accessor.
source§

fn set_max_history_size(&mut self, max_size: usize) -> Result<(), ReadlineError>

Set the maximum length for the history.
source§

fn set_history_ignore_dups(&mut self, yes: bool) -> Result<(), ReadlineError>

Tell if lines which match the previous history entry are saved or not in the history list. Read more
source§

fn set_history_ignore_space(&mut self, yes: bool)

Tell if lines which begin with a space character are saved or not in the history list. Read more
source§

fn set_completion_type(&mut self, completion_type: CompletionType)

Set completion_type.
source§

fn set_completion_prompt_limit(&mut self, completion_prompt_limit: usize)

The number of possible completions that determines when the user is asked whether the list of possibilities should be displayed.
source§

fn set_keyseq_timeout(&mut self, keyseq_timeout_ms: i32)

Timeout for ambiguous key sequences in milliseconds.
source§

fn set_edit_mode(&mut self, edit_mode: EditMode)

Choose between Emacs or Vi mode.
source§

fn set_auto_add_history(&mut self, yes: bool)

Tell if lines are automatically added to the history. Read more
source§

fn set_bell_style(&mut self, bell_style: BellStyle)

Set bell style: beep, flash or nothing.
source§

fn set_color_mode(&mut self, color_mode: ColorMode)

Forces colorization on or off. Read more
source§

fn set_behavior(&mut self, behavior: Behavior)

Whether to use stdio or not Read more
source§

fn set_tab_stop(&mut self, tab_stop: usize)

Horizontal space taken by a tab. Read more
source§

fn set_check_cursor_position(&mut self, yes: bool)

Check if cursor position is at leftmost before displaying prompt. Read more
source§

fn set_indent_size(&mut self, size: usize)

Indentation size for indent/dedent commands Read more
source§

fn enable_bracketed_paste(&mut self, enabled: bool)

Enable or disable bracketed paste on unix platform Read more
source§

impl<State> Default for ClapCmdBuilder<State>

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<State> RefUnwindSafe for ClapCmdBuilder<State>where State: RefUnwindSafe,

§

impl<State> Send for ClapCmdBuilder<State>where State: Send,

§

impl<State> Sync for ClapCmdBuilder<State>where State: Sync,

§

impl<State> Unpin for ClapCmdBuilder<State>where State: Unpin,

§

impl<State> UnwindSafe for ClapCmdBuilder<State>where State: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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, U> Into<U> for Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.