Skip to main content

detect_shell

Function detect_shell 

Source
pub fn detect_shell() -> Result<ShellType>
Expand description

Detect the user’s shell from the $SHELL environment variable.

Parses the shell path (e.g., /bin/zsh, /usr/bin/bash) and returns the corresponding ShellType.

§Returns

  • Ok(ShellType) - The detected shell type
  • Err(Autom8Error) - If $SHELL is not set or the shell is unsupported

§Examples

// With $SHELL=/bin/zsh
let shell = detect_shell()?;
assert_eq!(shell, ShellType::Zsh);