Add yarn support. Fix #958 (#15)

Authored-by: 0xMRTT <0xMRTT@tuta.io>
Approved-by: Thomas Schönauer <t.schoenauer@hgs-wt.at>
This commit is contained in:
DottoDev
2022-10-10 20:08:11 +00:00
committed by GitHub
parent 057fc3b533
commit 6bfdc4974b
3 changed files with 101 additions and 0 deletions

View File

@@ -168,6 +168,13 @@ pub struct Windows {
enable_winget: Option<bool>,
}
#[derive(Deserialize, Default, Debug)]
#[serde(deny_unknown_fields)]
#[allow(clippy::upper_case_acronyms)]
pub struct Yarn {
use_sudo: Option<bool>,
}
#[derive(Deserialize, Default, Debug)]
#[serde(deny_unknown_fields)]
#[allow(clippy::upper_case_acronyms)]
@@ -270,6 +277,7 @@ pub struct ConfigFile {
git: Option<Git>,
windows: Option<Windows>,
npm: Option<NPM>,
yarn: Option<Yarn>,
vim: Option<Vim>,
firmware: Option<Firmware>,
vagrant: Option<Vagrant>,
@@ -841,6 +849,15 @@ impl Config {
.and_then(|npm| npm.use_sudo)
.unwrap_or(false)
}
#[cfg(target_os = "linux")]
pub fn yarn_use_sudo(&self) -> bool {
self.config_file
.yarn
.as_ref()
.and_then(|yarn| yarn.use_sudo)
.unwrap_or(false)
}
#[cfg(target_os = "linux")]
pub fn firmware_upgrade(&self) -> bool {