Skip to main content

Bash

Struct Bash 

Source
pub struct Bash<'os> { /* private fields */ }
Expand description

The Bash shell.

Implementations§

Source§

impl<'os> Bash<'os>

Source

pub fn new(os: &'os UnixOs, credentials: Credentials) -> Result<Self, OsError>

Creates a Bash shell for a session.

Trait Implementations§

Source§

impl<'os> Shell for Bash<'os>

Source§

fn name(&self) -> &'static str

The shell’s name ("bash", "zsh", "powershell", …).
Source§

fn actor(&self) -> ActorId

The acting identity (used for filesystem lookups, for example tab completion).
Source§

fn environment(&self) -> &Environment

The shell environment (variables, PATH, HOME, …).
Source§

fn engine(&self) -> &Engine

The engine this shell operates on.
Source§

fn boot_time(&self) -> Timestamp

The boot time of the underlying OS (used for login banners).
Source§

fn hostname(&self) -> String

The virtual host name (from /etc/hostname or the OS equivalent).
Source§

fn cwd(&self) -> &VirtualPath

The current working directory.
Source§

fn prompt(&self, hostname: &str) -> String

The prompt string, ending with a trailing space. Read more
Source§

fn banner(&self) -> Option<String>

The banner printed before the first prompt, or None when the shell prints none. Unix shells print the Last login line; the Windows shells print their startup banners.
Source§

fn set_terminal_size(&mut self, rows: u16, cols: u16)

Reports the terminal size, exported as COLUMNS/LINES so commands (for example ls) lay out against the live console width. Read more
Source§

fn execute( &mut self, line: &str, stdin: &mut dyn Input, stdout: &mut dyn Output, stderr: &mut dyn Output, ) -> ExitStatus

Executes a line of shell input.
Source§

fn execute_with_terminal( &mut self, line: &str, stdin: &mut dyn Input, stdout: &mut dyn Output, stderr: &mut dyn Output, terminal: Option<&mut dyn Terminal>, ) -> ExitStatus

Executes a line with an optional terminal.
Source§

fn take_exit_status(&mut self) -> Option<ExitStatus>

Takes a pending session-exit request (exit [N]), if any. Read more
Source§

fn history(&self) -> &[String]

The command history: exactly the lines the interactive application recorded through Shell::record_history.
Source§

fn record_history(&mut self, line: &str)

Records one completed command line. Read more
Source§

fn needs_continuation(&self, input: &str) -> bool

Whether the input is an incomplete construct that needs more lines (for example a here-document or an unclosed if).

Auto Trait Implementations§

§

impl<'os> !RefUnwindSafe for Bash<'os>

§

impl<'os> !UnwindSafe for Bash<'os>

§

impl<'os> Freeze for Bash<'os>

§

impl<'os> Send for Bash<'os>

§

impl<'os> Sync for Bash<'os>

§

impl<'os> Unpin for Bash<'os>

§

impl<'os> UnsafeUnpin for Bash<'os>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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