feat: support doas

This commit is contained in:
iff 2023-07-31 01:58:37 +02:00
parent 6bd55fb316
commit ad0eaa17fc
4 changed files with 46 additions and 18 deletions

View file

@ -71,3 +71,13 @@ fn shell_default_history_file(shell: &str) -> String {
let file = shell_file_map.get(shell).expect("Unsupported shell.");
format!("{}/{}", std::env::var("HOME").unwrap(), file)
}
pub fn get_privilege() -> Option<String> {
let list = vec!["sudo", "doas"];
for command in list {
if std::process::Command::new(command).output().is_ok() {
return Some(command.to_string());
}
}
None
}