Add support for please (access elevation) (#310)
* 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 <t.schoenauer@hgs-wt.at>
This commit is contained in:
@@ -24,6 +24,7 @@ impl Sudo {
|
|||||||
pub fn detect() -> Option<Self> {
|
pub fn detect() -> Option<Self> {
|
||||||
which("doas")
|
which("doas")
|
||||||
.map(|p| (p, SudoKind::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("sudo").map(|p| (p, SudoKind::Sudo)))
|
||||||
.or_else(|| which("gsudo").map(|p| (p, SudoKind::Gsudo)))
|
.or_else(|| which("gsudo").map(|p| (p, SudoKind::Gsudo)))
|
||||||
.or_else(|| which("pkexec").map(|p| (p, SudoKind::Pkexec)))
|
.or_else(|| which("pkexec").map(|p| (p, SudoKind::Pkexec)))
|
||||||
@@ -47,6 +48,12 @@ impl Sudo {
|
|||||||
// See: https://man.openbsd.org/doas
|
// See: https://man.openbsd.org/doas
|
||||||
cmd.arg("echo");
|
cmd.arg("echo");
|
||||||
}
|
}
|
||||||
|
SudoKind::Please => {
|
||||||
|
// From `man please`
|
||||||
|
// -w, --warm
|
||||||
|
// Warm the access token and exit.
|
||||||
|
cmd.arg("-w");
|
||||||
|
}
|
||||||
SudoKind::Sudo => {
|
SudoKind::Sudo => {
|
||||||
// From `man sudo` on macOS:
|
// From `man sudo` on macOS:
|
||||||
// -v, --validate
|
// -v, --validate
|
||||||
@@ -96,6 +103,7 @@ impl Sudo {
|
|||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
enum SudoKind {
|
enum SudoKind {
|
||||||
Doas,
|
Doas,
|
||||||
|
Please,
|
||||||
Sudo,
|
Sudo,
|
||||||
Gsudo,
|
Gsudo,
|
||||||
Pkexec,
|
Pkexec,
|
||||||
|
|||||||
Reference in New Issue
Block a user