From fcf776fe07f9fa316b42c3aa86d19796ac3c734c Mon Sep 17 00:00:00 2001 From: Dan Sully Date: Thu, 2 Feb 2023 11:22:56 -0800 Subject: [PATCH] Add support for please (access elevation) (#310) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add support for please (access elevation) Please is a sudo-like tool written in Rust. https://gitlab.com/edneville/please * Fixes code typo --------- Co-authored-by: Thomas Schönauer <37108907+DottoDev@users.noreply.github.com> Co-authored-by: Thomas Schönauer --- src/sudo.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sudo.rs b/src/sudo.rs index 28c6fee9..85b65795 100644 --- a/src/sudo.rs +++ b/src/sudo.rs @@ -24,6 +24,7 @@ impl Sudo { pub fn detect() -> Option { which("doas") .map(|p| (p, SudoKind::Doas)) + .or_else(|| which("please").map(|p| (p, SudoKind::Please))) .or_else(|| which("sudo").map(|p| (p, SudoKind::Sudo))) .or_else(|| which("gsudo").map(|p| (p, SudoKind::Gsudo))) .or_else(|| which("pkexec").map(|p| (p, SudoKind::Pkexec))) @@ -47,6 +48,12 @@ impl Sudo { // See: https://man.openbsd.org/doas cmd.arg("echo"); } + SudoKind::Please => { + // From `man please` + // -w, --warm + // Warm the access token and exit. + cmd.arg("-w"); + } SudoKind::Sudo => { // From `man sudo` on macOS: // -v, --validate @@ -96,6 +103,7 @@ impl Sudo { #[derive(Clone, Copy, Debug)] enum SudoKind { Doas, + Please, Sudo, Gsudo, Pkexec,