ShellBuilder

Struct ShellBuilder 

Source
pub struct ShellBuilder<S: State = Empty> { /* private fields */ }
Expand description

Builder for Shell

Implementations§

Source§

impl<S: IsComplete> ShellBuilder<S>

Source

pub async fn build(self) -> Result<Shell, Error>

Returns a new shell instance created with the options provided

Source§

impl<S: State> ShellBuilder<S>

Source

pub fn disable_option(self, option: impl Into<String>) -> Self

Add a disabled option

Source

pub fn enable_option(self, option: impl Into<String>) -> Self

Add an enabled option

Source

pub fn disable_options( self, options: impl IntoIterator<Item: Into<String>>, ) -> Self

Add many disabled options

Source

pub fn enable_options( self, options: impl IntoIterator<Item: Into<String>>, ) -> Self

Add many enabled options

Source

pub fn disable_shopt_option(self, option: impl Into<String>) -> Self

Add a disabled shopt option

Source

pub fn enable_shopt_option(self, option: impl Into<String>) -> Self

Add an enabled shopt option

Source

pub fn disable_shopt_options( self, options: impl IntoIterator<Item: Into<String>>, ) -> Self

Add many disabled shopt options

Source

pub fn enable_shopt_options( self, options: impl IntoIterator<Item: Into<String>>, ) -> Self

Add many enabled shopt options

Source

pub fn builtin(self, name: impl Into<String>, reg: Registration) -> Self

Add a single builtin registration

Source

pub fn builtins( self, builtins: impl IntoIterator<Item = (String, Registration)>, ) -> Self

Add many builtin registrations

Source§

impl<S: State> ShellBuilder<S>

Source

pub fn disallow_overwriting_regular_files_via_output_redirection( self, value: bool, ) -> ShellBuilder<SetDisallowOverwritingRegularFilesViaOutputRedirection<S>>

Optional (Some / Option setters). Default: false.

Disallow overwriting regular files via output redirection.

Source

pub fn maybe_disallow_overwriting_regular_files_via_output_redirection( self, value: Option<bool>, ) -> ShellBuilder<SetDisallowOverwritingRegularFilesViaOutputRedirection<S>>

Optional (Some / Option setters). Default: false.

Disallow overwriting regular files via output redirection.

Source

pub fn do_not_execute_commands( self, value: bool, ) -> ShellBuilder<SetDoNotExecuteCommands<S>>
where S::DoNotExecuteCommands: IsUnset,

Optional (Some / Option setters). Default: false.

Do not execute commands.

Source

pub fn maybe_do_not_execute_commands( self, value: Option<bool>, ) -> ShellBuilder<SetDoNotExecuteCommands<S>>
where S::DoNotExecuteCommands: IsUnset,

Optional (Some / Option setters). Default: false.

Do not execute commands.

Source

pub fn exit_after_one_command( self, value: bool, ) -> ShellBuilder<SetExitAfterOneCommand<S>>
where S::ExitAfterOneCommand: IsUnset,

Optional (Some / Option setters). Default: false.

Exit after one command.

Source

pub fn maybe_exit_after_one_command( self, value: Option<bool>, ) -> ShellBuilder<SetExitAfterOneCommand<S>>
where S::ExitAfterOneCommand: IsUnset,

Optional (Some / Option setters). Default: false.

Exit after one command.

Source

pub fn interactive(self, value: bool) -> ShellBuilder<SetInteractive<S>>
where S::Interactive: IsUnset,

Optional (Some / Option setters). Default: false.

Whether the shell is interactive.

Source

pub fn maybe_interactive( self, value: Option<bool>, ) -> ShellBuilder<SetInteractive<S>>
where S::Interactive: IsUnset,

Optional (Some / Option setters). Default: false.

Whether the shell is interactive.

Source

pub fn login(self, value: bool) -> ShellBuilder<SetLogin<S>>
where S::Login: IsUnset,

Optional (Some / Option setters). Default: false.

Whether the shell is a login shell.

Source

pub fn maybe_login(self, value: Option<bool>) -> ShellBuilder<SetLogin<S>>
where S::Login: IsUnset,

Optional (Some / Option setters). Default: false.

Whether the shell is a login shell.

Source

pub fn no_editing(self, value: bool) -> ShellBuilder<SetNoEditing<S>>
where S::NoEditing: IsUnset,

Optional (Some / Option setters). Default: false.

Whether to skip using a readline-like interface for input.

Source

pub fn maybe_no_editing( self, value: Option<bool>, ) -> ShellBuilder<SetNoEditing<S>>
where S::NoEditing: IsUnset,

Optional (Some / Option setters). Default: false.

Whether to skip using a readline-like interface for input.

Source

pub fn no_profile(self, value: bool) -> ShellBuilder<SetNoProfile<S>>
where S::NoProfile: IsUnset,

Optional (Some / Option setters). Default: false.

Whether to skip sourcing the system profile.

Source

pub fn maybe_no_profile( self, value: Option<bool>, ) -> ShellBuilder<SetNoProfile<S>>
where S::NoProfile: IsUnset,

Optional (Some / Option setters). Default: false.

Whether to skip sourcing the system profile.

Source

pub fn no_rc(self, value: bool) -> ShellBuilder<SetNoRc<S>>
where S::NoRc: IsUnset,

Optional (Some / Option setters). Default: false.

Whether to skip sourcing the user’s rc file.

Source

pub fn maybe_no_rc(self, value: Option<bool>) -> ShellBuilder<SetNoRc<S>>
where S::NoRc: IsUnset,

Optional (Some / Option setters). Default: false.

Whether to skip sourcing the user’s rc file.

Source

pub fn rc_file(self, value: PathBuf) -> ShellBuilder<SetRcFile<S>>
where S::RcFile: IsUnset,

Optional (Some / Option setters).

Explicit override of rc file to load in interactive mode.

Source

pub fn maybe_rc_file(self, value: Option<PathBuf>) -> ShellBuilder<SetRcFile<S>>
where S::RcFile: IsUnset,

Optional (Some / Option setters).

Explicit override of rc file to load in interactive mode.

Source

pub fn do_not_inherit_env( self, value: bool, ) -> ShellBuilder<SetDoNotInheritEnv<S>>
where S::DoNotInheritEnv: IsUnset,

Optional (Some / Option setters). Default: false.

Whether to skip inheriting environment variables from the calling process.

Source

pub fn maybe_do_not_inherit_env( self, value: Option<bool>, ) -> ShellBuilder<SetDoNotInheritEnv<S>>
where S::DoNotInheritEnv: IsUnset,

Optional (Some / Option setters). Default: false.

Whether to skip inheriting environment variables from the calling process.

Source

pub fn fds(self, value: HashMap<ShellFd, OpenFile>) -> ShellBuilder<SetFds<S>>
where S::Fds: IsUnset,

Optional (Some / Option setters).

Provides a set of initial open files to be tracked by the shell.

Source

pub fn maybe_fds( self, value: Option<HashMap<ShellFd, OpenFile>>, ) -> ShellBuilder<SetFds<S>>
where S::Fds: IsUnset,

Optional (Some / Option setters).

Provides a set of initial open files to be tracked by the shell.

Source

pub fn posix(self, value: bool) -> ShellBuilder<SetPosix<S>>
where S::Posix: IsUnset,

Optional (Some / Option setters). Default: false.

Whether the shell is in POSIX compliance mode.

Source

pub fn maybe_posix(self, value: Option<bool>) -> ShellBuilder<SetPosix<S>>
where S::Posix: IsUnset,

Optional (Some / Option setters). Default: false.

Whether the shell is in POSIX compliance mode.

Source

pub fn print_commands_and_arguments( self, value: bool, ) -> ShellBuilder<SetPrintCommandsAndArguments<S>>
where S::PrintCommandsAndArguments: IsUnset,

Optional (Some / Option setters). Default: false.

Whether to print commands and arguments as they are read.

Source

pub fn maybe_print_commands_and_arguments( self, value: Option<bool>, ) -> ShellBuilder<SetPrintCommandsAndArguments<S>>
where S::PrintCommandsAndArguments: IsUnset,

Optional (Some / Option setters). Default: false.

Whether to print commands and arguments as they are read.

Source

pub fn read_commands_from_stdin( self, value: bool, ) -> ShellBuilder<SetReadCommandsFromStdin<S>>
where S::ReadCommandsFromStdin: IsUnset,

Optional (Some / Option setters). Default: false.

Whether commands are being read from stdin.

Source

pub fn maybe_read_commands_from_stdin( self, value: Option<bool>, ) -> ShellBuilder<SetReadCommandsFromStdin<S>>
where S::ReadCommandsFromStdin: IsUnset,

Optional (Some / Option setters). Default: false.

Whether commands are being read from stdin.

Source

pub fn shell_name(self, value: String) -> ShellBuilder<SetShellName<S>>
where S::ShellName: IsUnset,

Optional (Some / Option setters).

The name of the shell.

Source

pub fn maybe_shell_name( self, value: Option<String>, ) -> ShellBuilder<SetShellName<S>>
where S::ShellName: IsUnset,

Optional (Some / Option setters).

The name of the shell.

Source

pub fn shell_product_display_str( self, value: String, ) -> ShellBuilder<SetShellProductDisplayStr<S>>
where S::ShellProductDisplayStr: IsUnset,

Optional (Some / Option setters).

Optionally provides a display string describing the version and variant of the shell.

Source

pub fn maybe_shell_product_display_str( self, value: Option<String>, ) -> ShellBuilder<SetShellProductDisplayStr<S>>
where S::ShellProductDisplayStr: IsUnset,

Optional (Some / Option setters).

Optionally provides a display string describing the version and variant of the shell.

Source

pub fn sh_mode(self, value: bool) -> ShellBuilder<SetShMode<S>>
where S::ShMode: IsUnset,

Optional (Some / Option setters). Default: false.

Whether to run in maximal POSIX sh compatibility mode.

Source

pub fn maybe_sh_mode(self, value: Option<bool>) -> ShellBuilder<SetShMode<S>>
where S::ShMode: IsUnset,

Optional (Some / Option setters). Default: false.

Whether to run in maximal POSIX sh compatibility mode.

Source

pub fn verbose(self, value: bool) -> ShellBuilder<SetVerbose<S>>
where S::Verbose: IsUnset,

Optional (Some / Option setters). Default: false.

Whether to print verbose output.

Source

pub fn maybe_verbose(self, value: Option<bool>) -> ShellBuilder<SetVerbose<S>>
where S::Verbose: IsUnset,

Optional (Some / Option setters). Default: false.

Whether to print verbose output.

Source

pub fn max_function_call_depth( self, value: usize, ) -> ShellBuilder<SetMaxFunctionCallDepth<S>>
where S::MaxFunctionCallDepth: IsUnset,

Optional (Some / Option setters).

Maximum function call depth.

Source

pub fn maybe_max_function_call_depth( self, value: Option<usize>, ) -> ShellBuilder<SetMaxFunctionCallDepth<S>>
where S::MaxFunctionCallDepth: IsUnset,

Optional (Some / Option setters).

Maximum function call depth.

Source

pub fn key_bindings( self, value: Arc<Mutex<dyn KeyBindings>>, ) -> ShellBuilder<SetKeyBindings<S>>
where S::KeyBindings: IsUnset,

Optional (Some / Option setters).

Key bindings helper for the shell to use.

Source

pub fn maybe_key_bindings( self, value: Option<Arc<Mutex<dyn KeyBindings>>>, ) -> ShellBuilder<SetKeyBindings<S>>
where S::KeyBindings: IsUnset,

Optional (Some / Option setters).

Key bindings helper for the shell to use.

Source

pub fn error_formatter( self, value: Arc<Mutex<dyn ErrorFormatter>>, ) -> ShellBuilder<SetErrorFormatter<S>>
where S::ErrorFormatter: IsUnset,

Optional (Some / Option setters).

Error formatter helper for the shell to use.

Source

pub fn maybe_error_formatter( self, value: Option<Arc<Mutex<dyn ErrorFormatter>>>, ) -> ShellBuilder<SetErrorFormatter<S>>
where S::ErrorFormatter: IsUnset,

Optional (Some / Option setters).

Error formatter helper for the shell to use.

Source

pub fn shell_version(self, value: String) -> ShellBuilder<SetShellVersion<S>>
where S::ShellVersion: IsUnset,

Optional (Some / Option setters).

Brush implementation version.

Source

pub fn maybe_shell_version( self, value: Option<String>, ) -> ShellBuilder<SetShellVersion<S>>
where S::ShellVersion: IsUnset,

Optional (Some / Option setters).

Brush implementation version.

Auto Trait Implementations§

§

impl<S> Freeze for ShellBuilder<S>

§

impl<S = Empty> !RefUnwindSafe for ShellBuilder<S>

§

impl<S> Send for ShellBuilder<S>

§

impl<S> Sync for ShellBuilder<S>

§

impl<S> Unpin for ShellBuilder<S>

§

impl<S = Empty> !UnwindSafe for ShellBuilder<S>

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, 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