Skip to content

Commit

Permalink
deployment apply s option
Browse files Browse the repository at this point in the history
  • Loading branch information
CAGS295 committed Sep 6, 2023
1 parent 55b03bb commit 4a2f4a6
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions components/clarinet-cli/src/frontend/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 4a2f4a6

Please sign in to comment.