Skip to main content

active_tool

Function active_tool 

Source
pub fn active_tool() -> Result<PrivilegeTool, String>
Expand description

What: Resolve the privilege tool using the cached application settings.

Inputs: None (reads crate::theme::settings().privilege_mode).

Output:

  • Ok(PrivilegeTool) for successful resolution, or Ok(Sudo) after Auto failure (see [active_tool_for_mode]).
  • Err(String) when explicit sudo or doas mode cannot be satisfied.

Details:

  • Callers should propagate or display Err so misconfiguration is visible.
  • Same fallback rules as [active_tool_for_mode].

ยงErrors

Returns Err when PrivilegeMode::Sudo or PrivilegeMode::Doas is configured but that tool is not available on $PATH. PrivilegeMode::Auto never errors here: it falls back to PrivilegeTool::Sudo after logging a warning.