no_confirm -> interactive

main
Michal 2 years ago committed by GitHub
parent 91a2adc1f5
commit fa615753e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

2
Cargo.lock generated

@ -4,7 +4,7 @@ version = 3
[[package]] [[package]]
name = "Malachite" name = "Malachite"
version = "2.0.0" version = "2.1.0"
dependencies = [ dependencies = [
"clap", "clap",
"colored", "colored",

@ -1,6 +1,6 @@
[package] [package]
name = "Malachite" name = "Malachite"
version = "2.0.0" version = "2.1.0"
authors = [ "michal <michal@tar.black>" ] authors = [ "michal <michal@tar.black>" ]
edition = "2021" edition = "2021"
description = "Packaging tool for pacman repositories" description = "Packaging tool for pacman repositories"

@ -3,7 +3,7 @@
# Developer: Michal S <michal[at]tar[dot]black> # Developer: Michal S <michal[at]tar[dot]black>
pkgname=malachite pkgname=malachite
pkgver=2.0.0 pkgver=2.1.0
pkgrel=1 pkgrel=1
pkgdesc="Tool for packaging and maintaining pacman repositories" pkgdesc="Tool for packaging and maintaining pacman repositories"
arch=('x86_64') arch=('x86_64')

@ -64,9 +64,9 @@ pub enum Operation {
#[clap(short = 'n', long = "no-regen", action = ArgAction::SetTrue)] #[clap(short = 'n', long = "no-regen", action = ArgAction::SetTrue)]
no_regen: bool, 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)] #[clap(long, action = ArgAction::SetTrue)]
no_confirm: bool, interactive: bool,
}, },
/// Create and/or open local config file /// Create and/or open local config file

@ -60,9 +60,9 @@ fn main() {
Operation::Pull { Operation::Pull {
packages, packages,
no_regen, no_regen,
no_confirm, interactive,
.. ..
} => operations::pull(packages, exclude, verbose, no_regen, no_confirm), } => operations::pull(packages, exclude, verbose, no_regen, interactive),
Operation::RepoGen => { Operation::RepoGen => {
if !repository(verbose) { if !repository(verbose) {
crash!( crash!(

@ -10,7 +10,7 @@ struct PullParams {
no_regen: bool, no_regen: bool,
} }
fn do_the_pulling(repos: Vec<String>, verbose: bool, params: &PullParams, no_confirm: bool) { fn do_the_pulling(repos: Vec<String>, verbose: bool, params: &PullParams, interactive: bool) {
for repo in repos { for repo in repos {
// Set root dir to return after each git pull // Set root dir to return after each git pull
let root_dir = env::current_dir().unwrap(); let root_dir = env::current_dir().unwrap();
@ -54,15 +54,17 @@ fn do_the_pulling(repos: Vec<String>, verbose: bool, params: &PullParams, no_con
// If build_on_update is set, rebuild package // If build_on_update is set, rebuild package
if params.build_on_update { if params.build_on_update {
if no_confirm { if interactive {
packages_to_rebuild.push(repo);
} else {
let cont = prompt!(default true, "Rebuild package {}?", &repo); let cont = prompt!(default true, "Rebuild package {}?", &repo);
if cont { if cont {
info!("Package {} updated, staging for rebuild", &repo); info!("Package {} updated, staging for rebuild", &repo);
log!(verbose, "Pushing package {} to be rebuilt", &repo); log!(verbose, "Pushing package {} to be rebuilt", &repo);
packages_to_rebuild.push(repo); packages_to_rebuild.push(repo);
} else {
info!("Not rebuilding package {}", &repo);
} }
} else {
packages_to_rebuild.push(repo);
} }
} }
} else { } else {
@ -111,7 +113,7 @@ pub fn pull(
exclude: &[String], exclude: &[String],
verbose: bool, verbose: bool,
no_regen: bool, no_regen: bool,
no_confirm: bool, interactive: bool,
) { ) {
// Read config file // Read config file
let config = crate::parse_cfg(verbose); let config = crate::parse_cfg(verbose);
@ -200,6 +202,6 @@ pub fn pull(
build_on_update, build_on_update,
no_regen, no_regen,
}, },
no_confirm, interactive,
); );
} }

Loading…
Cancel
Save