From fa615753e4da60163c5dcc1d0fdaf18677349e4f Mon Sep 17 00:00:00 2001 From: Michal Date: Sun, 28 Aug 2022 05:32:15 +0000 Subject: [PATCH] no_confirm -> interactive --- Cargo.lock | 2 +- Cargo.toml | 2 +- PKGBUILD | 2 +- src/args.rs | 4 ++-- src/main.rs | 4 ++-- src/operations/pull.rs | 14 ++++++++------ 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f377363..54cc9aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 3 [[package]] name = "Malachite" -version = "2.0.0" +version = "2.1.0" dependencies = [ "clap", "colored", diff --git a/Cargo.toml b/Cargo.toml index 6f090d4..7842df2 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "Malachite" -version = "2.0.0" +version = "2.1.0" authors = [ "michal " ] edition = "2021" description = "Packaging tool for pacman repositories" diff --git a/PKGBUILD b/PKGBUILD index 723b626..bbeb77e 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -3,7 +3,7 @@ # Developer: Michal S pkgname=malachite -pkgver=2.0.0 +pkgver=2.1.0 pkgrel=1 pkgdesc="Tool for packaging and maintaining pacman repositories" arch=('x86_64') diff --git a/src/args.rs b/src/args.rs index 3cd555b..25e61c7 100644 --- a/src/args.rs +++ b/src/args.rs @@ -64,9 +64,9 @@ pub enum Operation { #[clap(short = 'n', long = "no-regen", action = ArgAction::SetTrue)] no_regen: bool, - /// Will not prompt for confirmation before rebuilding a package + /// Will prompt for confirmation before rebuilding a package #[clap(long, action = ArgAction::SetTrue)] - no_confirm: bool, + interactive: bool, }, /// Create and/or open local config file diff --git a/src/main.rs b/src/main.rs index ce97d3b..ea6879c 100755 --- a/src/main.rs +++ b/src/main.rs @@ -60,9 +60,9 @@ fn main() { Operation::Pull { packages, no_regen, - no_confirm, + interactive, .. - } => operations::pull(packages, exclude, verbose, no_regen, no_confirm), + } => operations::pull(packages, exclude, verbose, no_regen, interactive), Operation::RepoGen => { if !repository(verbose) { crash!( diff --git a/src/operations/pull.rs b/src/operations/pull.rs index ec703e1..3e79a2e 100644 --- a/src/operations/pull.rs +++ b/src/operations/pull.rs @@ -10,7 +10,7 @@ struct PullParams { no_regen: bool, } -fn do_the_pulling(repos: Vec, verbose: bool, params: &PullParams, no_confirm: bool) { +fn do_the_pulling(repos: Vec, verbose: bool, params: &PullParams, interactive: bool) { for repo in repos { // Set root dir to return after each git pull let root_dir = env::current_dir().unwrap(); @@ -54,15 +54,17 @@ fn do_the_pulling(repos: Vec, verbose: bool, params: &PullParams, no_con // If build_on_update is set, rebuild package if params.build_on_update { - if no_confirm { - packages_to_rebuild.push(repo); - } else { + if interactive { let cont = prompt!(default true, "Rebuild package {}?", &repo); if cont { info!("Package {} updated, staging for rebuild", &repo); log!(verbose, "Pushing package {} to be rebuilt", &repo); packages_to_rebuild.push(repo); + } else { + info!("Not rebuilding package {}", &repo); } + } else { + packages_to_rebuild.push(repo); } } } else { @@ -111,7 +113,7 @@ pub fn pull( exclude: &[String], verbose: bool, no_regen: bool, - no_confirm: bool, + interactive: bool, ) { // Read config file let config = crate::parse_cfg(verbose); @@ -200,6 +202,6 @@ pub fn pull( build_on_update, no_regen, }, - no_confirm, + interactive, ); }