Add an option for self-updating composer (fix #318) (#346)

This commit is contained in:
Roey Darwish Dror
2020-03-08 21:38:25 +02:00
committed by GitHub
parent ad93f683be
commit ce7af763bb
4 changed files with 50 additions and 8 deletions

View File

@@ -51,6 +51,11 @@ pub enum Step {
Tldr,
}
#[derive(Deserialize, Default, Debug)]
pub struct Composer {
self_update: Option<bool>,
}
#[derive(Deserialize, Default, Debug)]
#[serde(deny_unknown_fields)]
/// Configuration file
@@ -73,6 +78,7 @@ pub struct ConfigFile {
notify_each_step: Option<bool>,
accept_all_windows_updates: Option<bool>,
only: Option<Vec<Step>>,
composer: Option<Composer>,
}
impl ConfigFile {
@@ -356,6 +362,15 @@ impl Config {
self.config_file.accept_all_windows_updates.unwrap_or(true)
}
/// Whether Composer should update itself
pub fn composer_self_update(&self) -> bool {
self.config_file
.composer
.as_ref()
.and_then(|c| c.self_update)
.unwrap_or(false)
}
/// Whether to send a desktop notification at the beginning of every step
#[allow(dead_code)]
pub fn notify_each_step(&self) -> bool {