Simplify "steps" argument
This commit is contained in:
parent
088eb42521
commit
088cd97b19
@ -132,13 +132,14 @@ impl Updater {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn update(&self, sys: &System, opt: &Opt) -> Result<()> {
|
fn update(&self, sys: &System, opt: &Opt) -> Result<()> {
|
||||||
let steps = match &opt.steps {
|
let steps = if opt.steps.is_empty() {
|
||||||
Some(v) => v.iter().map(|u| u.into()).collect(),
|
vec![
|
||||||
None => vec![
|
|
||||||
UpdateSteps::Fetch,
|
UpdateSteps::Fetch,
|
||||||
UpdateSteps::Compile,
|
UpdateSteps::Compile,
|
||||||
UpdateSteps::Install,
|
UpdateSteps::Install,
|
||||||
],
|
]
|
||||||
|
} else {
|
||||||
|
opt.steps.iter().map(|u| u.into()).collect()
|
||||||
};
|
};
|
||||||
|
|
||||||
if steps.contains(&UpdateSteps::Fetch) {
|
if steps.contains(&UpdateSteps::Fetch) {
|
||||||
|
@ -27,9 +27,10 @@ pub struct Opt {
|
|||||||
pub yes: bool,
|
pub yes: bool,
|
||||||
|
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
pub quiet: bool,
|
pub quiet: bool, // TODO: use clap_verbosity_flag instead
|
||||||
|
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
pub steps: Option<Vec<String>>,
|
pub steps: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run(opt: &Opt) {
|
pub fn run(opt: &Opt) {
|
||||||
|
Loading…
Reference in New Issue
Block a user