summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@atos.net>2021-03-01 08:48:53 +0100
committerMatthias Beyer <matthias.beyer@atos.net>2021-03-01 08:49:43 +0100
commitb0a5ccbf467e7e9aa5c73062e91c39a017c9602a (patch)
treeb2d2555d9ea1daad78e720fd0fc1a921af8fa989
parent184fe5130f8354d303dc521eb6ba047e9434bb54 (diff)
Add flag to be able to update without confirmation prompt
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
-rw-r--r--src/cli.rs7
-rw-r--r--src/commands/release.rs3
2 files changed, 9 insertions, 1 deletions
diff --git a/src/cli.rs b/src/cli.rs
index e1ffff7..0f45984 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -776,6 +776,13 @@ pub fn cli<'a>() -> App<'a> {
.long("update")
.about("Do update a package if it already exists in the release store")
)
+ .arg(Arg::new("noninteractive")
+ .required(false)
+ .multiple(false)
+ .long("non-interactive")
+ .about("Dont be interactive (only with --update at the moment)")
+ .requires("package_do_update")
+ )
)
)
diff --git a/src/commands/release.rs b/src/commands/release.rs
index 21640ff..65641d5 100644
--- a/src/commands/release.rs
+++ b/src/commands/release.rs
@@ -133,6 +133,7 @@ async fn new_release(
let release_store = crate::db::models::ReleaseStore::create(&conn, release_store_name)?;
let do_update = matches.is_present("package_do_update");
+ let interactive = !matches.is_present("noninteractive");
let now = chrono::offset::Local::now().naive_local();
arts.into_iter()
@@ -156,7 +157,7 @@ async fn new_release(
return Err(anyhow!("Does already exist: {}", dest_path.display()));
} else if dest_path.exists() && do_update {
writeln!(std::io::stderr(), "Going to update: {}", dest_path.display())?;
- if !dialoguer::Confirm::new().with_prompt("Continue?").interact()? {
+ if interactive && !dialoguer::Confirm::new().with_prompt("Continue?").interact()? {
return Err(anyhow!("Does already exist: {} and update was denied", dest_path.display()));
}
}