* Allow running NPM as sudo (fix #690) * asd * fix
This commit is contained in:
committed by
GitHub
parent
f8648c9bc7
commit
f39899c3ff
@@ -147,6 +147,13 @@ pub struct Windows {
|
||||
open_remotes_in_new_terminal: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
pub struct NPM {
|
||||
use_sudo: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Brew {
|
||||
@@ -204,6 +211,7 @@ pub struct ConfigFile {
|
||||
linux: Option<Linux>,
|
||||
git: Option<Git>,
|
||||
windows: Option<Windows>,
|
||||
npm: Option<NPM>,
|
||||
vagrant: Option<Vagrant>,
|
||||
}
|
||||
|
||||
@@ -713,6 +721,15 @@ impl Config {
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
pub fn npm_use_sudo(&self) -> bool {
|
||||
self.config_file
|
||||
.npm
|
||||
.as_ref()
|
||||
.and_then(|npm| npm.use_sudo)
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
str_value!(linux, emerge_sync_flags);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user