Add ability to ignore certain failures (#461)
This commit is contained in:
committed by
GitHub
parent
3d4917fa88
commit
5c7f04c2cf
@@ -58,7 +58,7 @@ macro_rules! get_deprecated {
|
||||
|
||||
type Commands = BTreeMap<String, String>;
|
||||
|
||||
#[derive(EnumString, EnumVariantNames, Debug, Clone, PartialEq, Deserialize, EnumIter)]
|
||||
#[derive(EnumString, EnumVariantNames, Debug, Clone, PartialEq, Deserialize, EnumIter, Copy)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum Step {
|
||||
@@ -103,6 +103,8 @@ pub enum Step {
|
||||
Flatpak,
|
||||
Snap,
|
||||
Pkg,
|
||||
Powershell,
|
||||
CustomCommands,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default, Debug)]
|
||||
@@ -161,6 +163,7 @@ pub struct ConfigFile {
|
||||
git_repos: Option<Vec<String>>,
|
||||
predefined_git_repos: Option<bool>,
|
||||
disable: Option<Vec<Step>>,
|
||||
ignore_failures: Option<Vec<Step>>,
|
||||
remote_topgrades: Option<Vec<String>>,
|
||||
ssh_arguments: Option<String>,
|
||||
git_arguments: Option<String>,
|
||||
@@ -605,6 +608,15 @@ impl Config {
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
/// Should we ignore failures for this step
|
||||
pub fn ignore_failure(&self, step: Step) -> bool {
|
||||
self.config_file
|
||||
.ignore_failures
|
||||
.as_ref()
|
||||
.map(|v| v.contains(&step))
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn use_predefined_git_repos(&self) -> bool {
|
||||
!self.opt.disable_predefined_git_repos
|
||||
&& get_deprecated!(&self.config_file, predefined_git_repos, git, pull_predefined).unwrap_or(true)
|
||||
|
||||
Reference in New Issue
Block a user