* Merge the command line and the configuration flags of --only and --disable (fix #805) * Fix
This commit is contained in:
committed by
GitHub
parent
e9d809ddb0
commit
942702d1d2
@@ -11,7 +11,7 @@ use pretty_env_logger::formatted_timed_builder;
|
|||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
use strum::{EnumIter, EnumString, EnumVariantNames, IntoEnumIterator, VariantNames};
|
use strum::{EnumIter, EnumString, EnumVariantNames, VariantNames};
|
||||||
use sys_info::hostname;
|
use sys_info::hostname;
|
||||||
use which_crate::which;
|
use which_crate::which;
|
||||||
|
|
||||||
@@ -510,20 +510,18 @@ impl Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn allowed_steps(opt: &CommandLineArgs, config_file: &ConfigFile) -> Vec<Step> {
|
fn allowed_steps(opt: &CommandLineArgs, config_file: &ConfigFile) -> Vec<Step> {
|
||||||
let mut enabled_steps: Vec<Step> = if !opt.only.is_empty() {
|
let mut enabled_steps: Vec<Step> = Vec::new();
|
||||||
opt.only.clone()
|
enabled_steps.extend(&opt.only);
|
||||||
} else {
|
|
||||||
config_file
|
|
||||||
.only
|
|
||||||
.as_ref()
|
|
||||||
.map_or_else(|| Step::iter().collect(), |v| v.clone())
|
|
||||||
};
|
|
||||||
|
|
||||||
let disabled_steps: Vec<Step> = if !opt.disable.is_empty() {
|
if let Some(only) = config_file.only.as_ref() {
|
||||||
opt.disable.clone()
|
enabled_steps.extend(only)
|
||||||
} else {
|
}
|
||||||
config_file.disable.as_ref().map_or_else(Vec::new, |v| v.clone())
|
|
||||||
};
|
let mut disabled_steps: Vec<Step> = Vec::new();
|
||||||
|
disabled_steps.extend(&opt.disable);
|
||||||
|
if let Some(disabled) = config_file.disable.as_ref() {
|
||||||
|
disabled_steps.extend(disabled);
|
||||||
|
}
|
||||||
|
|
||||||
enabled_steps.retain(|e| !disabled_steps.contains(e) || opt.only.contains(e));
|
enabled_steps.retain(|e| !disabled_steps.contains(e) || opt.only.contains(e));
|
||||||
enabled_steps
|
enabled_steps
|
||||||
|
|||||||
Reference in New Issue
Block a user