Add sudo_command option (#379)
This allows the user to specify the preferred sudo command to be used instead of the command chosen by Sudo::detect
This commit is contained in:
committed by
GitHub
parent
462016e51e
commit
a3628d0d49
@@ -18,6 +18,7 @@ use tracing::debug;
|
||||
use which_crate::which;
|
||||
|
||||
use crate::command::CommandExt;
|
||||
use crate::sudo::SudoKind;
|
||||
|
||||
use super::utils::{editor, hostname};
|
||||
|
||||
@@ -293,6 +294,7 @@ pub struct Vim {
|
||||
#[serde(deny_unknown_fields)]
|
||||
/// Configuration file
|
||||
pub struct ConfigFile {
|
||||
sudo_command: Option<SudoKind>,
|
||||
pre_sudo: Option<bool>,
|
||||
pre_commands: Option<Commands>,
|
||||
post_commands: Option<Commands>,
|
||||
@@ -1017,6 +1019,10 @@ impl Config {
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn sudo_command(&self) -> Option<SudoKind> {
|
||||
self.config_file.sudo_command
|
||||
}
|
||||
|
||||
/// If `true`, `sudo` should be called after `pre_commands` in order to elevate at the
|
||||
/// start of the session (and not in the middle).
|
||||
pub fn pre_sudo(&self) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user