pub enum Shell {
Zsh,
Bash,
Fish,
PowerShell,
Nushell,
}Expand description
Which shell the request originates from.
Variants§
Implementations§
Source§impl Shell
impl Shell
pub fn as_str(&self) -> &'static str
pub fn index(&self) -> usize
Sourcepub fn detect_default() -> Self
pub fn detect_default() -> Self
Detect default shell from env vars + platform.
Priority:
NIGHTHAWK_SHELLenv var (explicit override, all platforms)- Parent process name via
/proc(Linux/macOS only) - Shell version env vars like
ZSH_VERSION(Unix only, rarely exported) $SHELLenv var (Unix only, login shell - may differ from current)- Platform default: PowerShell on Windows, Zsh on Unix
Note: On Windows, only NIGHTHAWK_SHELL override works reliably.
The hint will always suggest PowerShell unless overridden.
Sourcepub fn detect_from(
nighthawk_shell: Option<String>,
zsh_version: Option<String>,
bash_version: Option<String>,
fish_version: Option<String>,
nu_version: Option<String>,
shell_env: Option<String>,
) -> Self
pub fn detect_from( nighthawk_shell: Option<String>, zsh_version: Option<String>, bash_version: Option<String>, fish_version: Option<String>, nu_version: Option<String>, shell_env: Option<String>, ) -> Self
Pure detection function for testability — takes env values as parameters.
Priority:
NIGHTHAWK_SHELLoverride (explicit user choice)- Shell version env vars:
ZSH_VERSION,BASH_VERSION,FISH_VERSION,NU_VERSION(set by the current shell, not inherited — detects actual running shell) $SHELLfallback (login shell — may differ from current interactive shell)- Platform default (PowerShell on Windows, Zsh on Unix)
Trait Implementations§
impl Copy for Shell
Source§impl<'de> Deserialize<'de> for Shell
impl<'de> Deserialize<'de> for Shell
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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 UnsafeUnpin 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.