Add a configuration variable for greedy cask (fix #401)

This commit is contained in:
Roey Darwish Dror
2020-05-12 09:07:54 +03:00
parent 0a10b110c2
commit 5060451066
4 changed files with 36 additions and 7 deletions

View File

@@ -51,6 +51,11 @@ pub enum Step {
Tmux,
}
#[derive(Deserialize, Default, Debug)]
pub struct Brew {
greedy_cask: Option<bool>,
}
#[derive(Deserialize, Default, Debug)]
pub struct Composer {
self_update: Option<bool>,
@@ -79,6 +84,7 @@ pub struct ConfigFile {
accept_all_windows_updates: Option<bool>,
only: Option<Vec<Step>>,
composer: Option<Composer>,
brew: Option<Brew>,
}
impl ConfigFile {
@@ -366,6 +372,15 @@ impl Config {
self.config_file.accept_all_windows_updates.unwrap_or(true)
}
/// Whether Brew cask should be greedy
pub fn brew_cask_greedy(&self) -> bool {
self.config_file
.brew
.as_ref()
.and_then(|c| c.greedy_cask)
.unwrap_or(false)
}
/// Whether Composer should update itself
pub fn composer_self_update(&self) -> bool {
self.config_file