fix(pkgfile): make pkgfile opt-in (#1449)
Co-authored-by: Gideon <87426140+GideonBear@users.noreply.github.com>
This commit is contained in:
@@ -402,6 +402,12 @@ pub struct Rustup {
|
||||
channels: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug, Merge)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct Pkgfile {
|
||||
enable: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug, Merge)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
/// Configuration file
|
||||
@@ -492,6 +498,9 @@ pub struct ConfigFile {
|
||||
|
||||
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||
rustup: Option<Rustup>,
|
||||
|
||||
#[merge(strategy = crate::utils::merge_strategies::inner_merge_opt)]
|
||||
pkgfile: Option<Pkgfile>,
|
||||
}
|
||||
|
||||
fn config_directory() -> PathBuf {
|
||||
@@ -1783,6 +1792,14 @@ impl Config {
|
||||
.and_then(|doom| doom.aot)
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn enable_pkgfile(&self) -> bool {
|
||||
self.config_file
|
||||
.pkgfile
|
||||
.as_ref()
|
||||
.and_then(|pkgfile| pkgfile.enable)
|
||||
.unwrap_or(false)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user