pub enum TaskShell {
None,
Auto,
Bash,
Sh,
Zsh,
Fish,
}
Expand description
Shell type for task execution.
Supports multiple shell types across Unix and Windows platforms with automatic detection.
§Platform Support
- Unix: Bash, Sh, Zsh, Fish
- Windows: Cmd, Powershell
- Cross-platform: Auto (detects the best available shell), None (direct execution)
§Examples
use tcrm_monitor::monitor::config::TaskShell;
// Use automatic shell detection
let auto_shell = TaskShell::Auto;
// Execute without shell
let direct = TaskShell::None;
// Platform-specific shells
#[cfg(unix)]
let bash_shell = TaskShell::Bash;
#[cfg(windows)]
let powershell = TaskShell::Powershell;
Variants§
None
Execute command directly without shell
Auto
Automatic shell detection based on platform and availability
Bash
Bourne Again Shell (Unix only)
Sh
POSIX Shell (Unix only)
Zsh
Z Shell (Unix only)
Fish
Fish Shell (Unix only)
Implementations§
Source§impl TaskShell
impl TaskShell
Sourcepub fn is_unix(&self) -> bool
pub fn is_unix(&self) -> bool
Returns true if this shell is available on Unix systems.
§Examples
use tcrm_monitor::monitor::config::TaskShell;
assert!(TaskShell::Auto.is_cross_platform());
assert!(TaskShell::None.is_cross_platform());
#[cfg(unix)]
{
assert!(TaskShell::Bash.is_unix());
assert!(TaskShell::Zsh.is_unix());
}
#[cfg(windows)]
{
assert!(!TaskShell::Cmd.is_unix());
}
Sourcepub fn is_windows(&self) -> bool
pub fn is_windows(&self) -> bool
Returns true if this shell is available on Windows systems.
§Examples
use tcrm_monitor::monitor::config::TaskShell;
#[cfg(windows)]
{
assert!(TaskShell::Powershell.is_windows());
assert!(TaskShell::Cmd.is_windows());
}
#[cfg(unix)]
{
assert!(!TaskShell::Bash.is_windows());
}
Sourcepub fn is_cross_platform(&self) -> bool
pub fn is_cross_platform(&self) -> bool
Returns true if this shell is available on all platforms.
§Examples
use tcrm_monitor::monitor::config::TaskShell;
assert!(TaskShell::Auto.is_cross_platform());
assert!(TaskShell::None.is_cross_platform());
Sourcepub fn command_name(&self) -> Option<&str>
pub fn command_name(&self) -> Option<&str>
Returns the command name used to invoke this shell, if applicable.
§Examples
use tcrm_monitor::monitor::config::TaskShell;
assert_eq!(TaskShell::Auto.command_name(), None);
assert_eq!(TaskShell::None.command_name(), None);
#[cfg(unix)]
assert_eq!(TaskShell::Bash.command_name(), Some("bash"));
#[cfg(windows)]
assert_eq!(TaskShell::Powershell.command_name(), Some("powershell"));
Trait Implementations§
impl StructuralPartialEq for TaskShell
Auto Trait Implementations§
impl Freeze for TaskShell
impl RefUnwindSafe for TaskShell
impl Send for TaskShell
impl Sync for TaskShell
impl Unpin for TaskShell
impl UnwindSafe for TaskShell
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