Add a flag to disable the predefined git repositories (fix #305)

This commit is contained in:
Roey Darwish Dror
2020-01-28 21:04:59 +02:00
parent 59fc516711
commit 4f7f6281d7
3 changed files with 44 additions and 29 deletions

View File

@@ -57,6 +57,7 @@ pub struct ConfigFile {
pre_commands: Option<Commands>,
commands: Option<Commands>,
git_repos: Option<Vec<String>>,
predefined_git_repos: Option<bool>,
disable: Option<Vec<Step>>,
remote_topgrades: Option<Vec<String>>,
ssh_arguments: Option<String>,
@@ -189,6 +190,10 @@ pub struct CommandLineArgs {
/// Say yes to package manager's prompt (experimental)
#[structopt(short = "y", long = "yes")]
yes: bool,
/// Disable predefined_git_repos
#[structopt(long = "disable-predefined-git-repos")]
disable_predefined_git_repos: bool,
}
impl CommandLineArgs {
@@ -349,4 +354,8 @@ impl Config {
None => "--devel",
}
}
pub fn use_predefined_git_repos(&self) -> bool {
!self.opt.disable_predefined_git_repos && self.config_file.predefined_git_repos.unwrap_or(true)
}
}