From 4a2f4a6d74361766dab241edb7bb4909d2b2da06 Mon Sep 17 00:00:00 2001 From: Carlos Alejandro Gutierrez Sandoval Date: Wed, 23 Aug 2023 08:44:25 -0600 Subject: [PATCH] deployment apply s option --- components/clarinet-cli/src/frontend/cli.rs | 26 ++++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/components/clarinet-cli/src/frontend/cli.rs b/components/clarinet-cli/src/frontend/cli.rs index aeec3d5a7..a10ba4f65 100644 --- a/components/clarinet-cli/src/frontend/cli.rs +++ b/components/clarinet-cli/src/frontend/cli.rs @@ -367,6 +367,9 @@ struct ApplyDeployment { /// Display streams of logs instead of terminal UI dashboard #[clap(long = "no-dashboard")] pub no_dashboard: bool, + /// Skip the user confirmation prompt before applying + #[clap(long = "skip-prompt", short = 's')] + pub skip_user_confirmation: bool, } #[derive(Parser, PartialEq, Clone, Debug)] @@ -814,16 +817,21 @@ pub fn main() { let node_url = deployment.stacks_node.clone().unwrap(); println!( - "The following deployment plan will be applied:\n{}\n\n{}", - DeploymentSynthesis::from_deployment(&deployment), - yellow!("Continue [Y/n]?") + "The following deployment plan will be applied:\n{}\n\n", + DeploymentSynthesis::from_deployment(&deployment) ); - let mut buffer = String::new(); - std::io::stdin().read_line(&mut buffer).unwrap(); - if !buffer.starts_with("Y") && !buffer.starts_with("y") && !buffer.starts_with("\n") - { - println!("Deployment aborted"); - std::process::exit(1); + + if !cmd.skip_user_confirmation { + println!("{}", yellow!("Continue [Y/n]?")); + let mut buffer = String::new(); + std::io::stdin().read_line(&mut buffer).unwrap(); + if !buffer.starts_with("Y") + && !buffer.starts_with("y") + && !buffer.starts_with("\n") + { + println!("Deployment aborted"); + std::process::exit(1); + } } let (command_tx, command_rx) = std::sync::mpsc::channel();