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]]
name = "Malachite"
version = "2.0.0"
version = "2.1.0"
dependencies = [
"clap",
"colored",

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

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

@ -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

@ -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!(

@ -10,7 +10,7 @@ struct PullParams {
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 {
// 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<String>, 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,
);
}

Loading…
Cancel
Save