Add pre_sudo option (#219)

* Add `pre_sudo` option
This commit is contained in:
Rebecca Turner
2022-11-24 14:15:43 -05:00
committed by GitHub
parent f2c7e4848e
commit e456155562
6 changed files with 54 additions and 9 deletions

View File

@@ -269,6 +269,7 @@ pub struct Vim {
#[serde(deny_unknown_fields)]
/// Configuration file
pub struct ConfigFile {
pre_sudo: Option<bool>,
pre_commands: Option<Commands>,
post_commands: Option<Commands>,
commands: Option<Commands>,
@@ -947,6 +948,12 @@ impl Config {
.unwrap_or(false)
}
/// 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 {
self.config_file.pre_sudo.unwrap_or(false)
}
#[cfg(target_os = "linux")]
pub fn npm_use_sudo(&self) -> bool {
self.config_file