#[derive(Debug, Clone, Copy, PartialEq)]
pub enum ExternalExecutionMode {
FromParentShell,
LeaveBroot,
StayInBroot,
}
impl ExternalExecutionMode {
pub fn is_from_shell(self) -> bool {
matches!(self, Self::FromParentShell)
}
pub fn is_leave_broot(self) -> bool {
!matches!(self, Self::StayInBroot)
}
pub fn from_conf(
from_shell: Option<bool>, leave_broot: Option<bool>, ) -> Self {
if from_shell.unwrap_or(false) {
Self::FromParentShell
} else if leave_broot.unwrap_or(true) {
Self::LeaveBroot
} else {
Self::StayInBroot
}
}
}