pub enum Shell {
Bash,
Fish,
Powershell,
Cmd,
Zsh,
Nushell,
Csh,
Ksh,
}Expand description
Shells for which virtualenv activation scripts are available.
Variants§
Bash
Bourne Again SHell (bash)
Fish
Friendly Interactive SHell (fish)
Powershell
PowerShell
Cmd
Cmd (Command Prompt)
Zsh
Z SHell (zsh)
Nushell
Nushell
Csh
C SHell (csh)
Ksh
Korn SHell (ksh)
Implementations§
Source§impl Shell
impl Shell
Sourcepub fn from_env() -> Option<Self>
pub fn from_env() -> Option<Self>
Determine the user’s current shell from the environment.
This will read the SHELL environment variable and try to determine which shell is in use
from that.
If SHELL is not set, then on windows, it will default to powershell, and on
other OSes it will return None.
If SHELL is set, but contains a value that doesn’t correspond to one of the supported
shell types, then return None.
Sourcepub fn from_shell_path(path: impl AsRef<Path>) -> Option<Self>
pub fn from_shell_path(path: impl AsRef<Path>) -> Option<Self>
Sourcepub fn supports_update(self) -> bool
pub fn supports_update(self) -> bool
Returns true if the shell supports a PATH update command.
Sourcepub fn configuration_files(self) -> Vec<PathBuf>
pub fn configuration_files(self) -> Vec<PathBuf>
Return the configuration files that should be modified to append to a shell’s PATH.
Some of the logic here is based on rustup’s rc file detection.
Sourcepub fn contains_path(path: &Path) -> bool
pub fn contains_path(path: &Path) -> bool
Returns true if the given path is on the PATH in this shell.
Sourcepub fn prepend_path(self, path: &Path) -> Option<String>
pub fn prepend_path(self, path: &Path) -> Option<String>
Returns the command necessary to prepend a directory to the PATH in this shell.
Trait Implementations§
impl Copy for Shell
impl Eq for Shell
impl StructuralPartialEq for Shell
Auto Trait Implementations§
impl Freeze for Shell
impl RefUnwindSafe for Shell
impl Send for Shell
impl Sync for Shell
impl Unpin for Shell
impl UnwindSafe for Shell
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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