[][src]Struct slaps::Config

pub struct Config<'a> {
    pub color_mode: ColorMode,
    pub completion_type: CompletionType,
    pub prompt: &'a str,
    pub password_prompt: &'a str,
    pub help_template: &'a str,
    pub subcommand_help_template: &'a str,
    pub subcommand_help_template_no_args: &'a str,
    pub highlighter_style_command: Style,
    pub highlighter_style_argument: Style,
    pub highlighter_style_value: Style,
    pub highlighter_style_mismatched_quotes: Style,
    pub highlighter_underline_word_under_cursor: bool,
}

Configuration for the internal sub-components of slaps.

Fields

color_mode: ColorMode

Colorization mode.

completion_type: CompletionType

Tab-completion type.

prompt: &'a str

Prompt for input.

password_prompt: &'a str

Prompt for passwords.

help_template: &'a str

Template for the root help command.

subcommand_help_template: &'a str

Help template for subcommands with arguments.

subcommand_help_template_no_args: &'a str

Help template for subcommands without arguments.

highlighter_style_command: Style

Style to use to highlight commands.

highlighter_style_argument: Style

Style to use to highlight arguments.

highlighter_style_value: Style

Style to use to highlight values.

highlighter_style_mismatched_quotes: Style

Style to use to highlight mismatched quotes.

highlighter_underline_word_under_cursor: bool

Whether to underline the word currently under cursor while editing.

Implementations

impl<'a> Config<'a>[src]

#[must_use]pub fn color_mode(self, color_mode: ColorMode) -> Self[src]

Forces colorization on or off.

By default, colorization is on except if stdout is not a TTY.

Examples

use slaps::{Config, ColorMode};

let config = Config::default().color_mode(ColorMode::Disabled);

#[must_use]pub fn completion_type(self, completion_mode: CompletionType) -> Self[src]

Sets the tab completion type.

Examples

use slaps::{Config, CompletionType};

let config = Config::default().completion_type(CompletionType::List);

#[must_use]pub fn set_prompt(self, prompt: &'a str) -> Self[src]

Sets the string used to prompt for input.

Examples

use slaps::Config;

let config = Config::default().set_prompt(" >>> ");

#[must_use]pub fn set_password_prompt(self, prompt: &'a str) -> Self[src]

Sets the string used to prompt for passwords.

Examples

use slaps::Config;

let config = Config::default().set_password_prompt("Password? ");

#[must_use]pub fn help_template(self, template: &'a str) -> Self[src]

Sets the template for the root help command.

Examples

use slaps::Config;

let config = Config::default().help_template("Subcommands: {subcommands}");

#[must_use]pub fn subcommand_help_template(self, template: &'a str) -> Self[src]

Sets the help template for subcommands with arguments.

Examples

use slaps::Config;

let config = Config::default().subcommand_help_template("Usage: {usage}");

#[must_use]pub fn subcommand_help_template_no_args(self, template: &'a str) -> Self[src]

Sets the help template for subcommands without arguments.

Examples

use slaps::Config;

let config = Config::default().subcommand_help_template_no_args("About: {about}");

#[must_use]pub fn highlighter_command_style(self, style: Style) -> Self[src]

Sets the Style used to highlight commands and subcommands.

Examples

use slaps::Config;
use ansi_term::Color;

let config = Config::default().highlighter_command_style(Color::Blue.normal());

#[must_use]pub fn highlighter_argument_style(self, style: Style) -> Self[src]

Sets the Style used to highlight arguments.

Examples

use slaps::Config;
use ansi_term::Color;

let config = Config::default().highlighter_argument_style(Color::Blue.normal());

#[must_use]pub fn highlighter_value_style(self, style: Style) -> Self[src]

Sets the Style used to highlight values for positional and named arguments.

Examples

use slaps::Config;
use ansi_term::Color;

let config = Config::default().highlighter_value_style(Color::Blue.normal());

#[must_use]pub fn highlighter_mismatched_quote_style(self, style: Style) -> Self[src]

Sets the Style used to highlight unclosed quotation marks.

Examples

use slaps::Config;
use ansi_term::Color;

let config = Config::default().highlighter_mismatched_quote_style(Color::Blue.normal());

#[must_use]pub fn highlighter_underline_word_under_cursor(self, underline: bool) -> Self[src]

Enables or disables underlining the word currently under cursor by the input highlighter.

Examples

use slaps::Config;
use ansi_term::Color;

let config = Config::default().highlighter_underline_word_under_cursor(false);

Trait Implementations

impl<'a> Clone for Config<'a>[src]

impl<'a> Copy for Config<'a>[src]

impl<'a> Debug for Config<'a>[src]

impl<'_> Default for Config<'_>[src]

impl<'_, '_> Into<Config> for &'_ Config<'_>[src]

impl<'a> PartialEq<Config<'a>> for Config<'a>[src]

impl<'a> StructuralPartialEq for Config<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Config<'a>

impl<'a> Send for Config<'a>

impl<'a> Sync for Config<'a>

impl<'a> Unpin for Config<'a>

impl<'a> UnwindSafe for Config<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.