Simplify "steps" argument

This commit is contained in:
Zykino 2023-01-19 23:46:30 +01:00
parent 088eb42521
commit 088cd97b19
2 changed files with 8 additions and 6 deletions

View File

@ -132,13 +132,14 @@ impl Updater {
}
fn update(&self, sys: &System, opt: &Opt) -> Result<()> {
let steps = match &opt.steps {
Some(v) => v.iter().map(|u| u.into()).collect(),
None => vec![
let steps = if opt.steps.is_empty() {
vec![
UpdateSteps::Fetch,
UpdateSteps::Compile,
UpdateSteps::Install,
],
]
} else {
opt.steps.iter().map(|u| u.into()).collect()
};
if steps.contains(&UpdateSteps::Fetch) {

View File

@ -27,9 +27,10 @@ pub struct Opt {
pub yes: bool,
#[arg(short, long)]
pub quiet: bool,
pub quiet: bool, // TODO: use clap_verbosity_flag instead
#[arg(short, long)]
pub steps: Option<Vec<String>>,
pub steps: Vec<String>,
}
pub fn run(opt: &Opt) {