Globalised `-v` and `--noconfirm`, made `--noconfirm` apply to clean properly. Fmt + import optimise.

i18n
Michal 2 years ago
parent 4dbaa93d45
commit c6f472cb90

@ -7,11 +7,11 @@ pub struct Args {
pub subcommand: Option<Operation>, pub subcommand: Option<Operation>,
/// Sets the level of verbosity /// Sets the level of verbosity
#[clap(long, short, parse(from_occurrences))] #[clap(long, short, parse(from_occurrences), global = true)]
pub verbose: usize, pub verbose: usize,
/// Complete operation without prompting user /// Complete operation without prompting user
#[clap(long = "noconfirm")] #[clap(long = "noconfirm", global = true)]
pub no_confirm: bool, pub no_confirm: bool,
} }

@ -63,7 +63,11 @@ pub fn clean(options: Options) {
} }
} }
let clear_cache = prompt("Also clear pacman's package cache?".to_string(), false); let clear_cache = if !noconfirm {
prompt("Also clear pacman's package cache?".to_string(), false)
} else {
true
};
if clear_cache { if clear_cache {
let mut pacman_args = vec!["-Sc"]; let mut pacman_args = vec!["-Sc"];
if noconfirm { if noconfirm {

Loading…
Cancel
Save