Skip to content

Commit

Permalink
changed yes/no dialog in cli/clean.rs to use Confirm of dialoguer
Browse files Browse the repository at this point in the history
  • Loading branch information
mxwt00 committed Jan 18, 2024
1 parent 23876dd commit b73022e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cli/src/clean.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::io;
use std::path::PathBuf;

use anyhow::{anyhow, Context, Result};
use clap::Parser;
use dialoguer::Confirm;
use log::info;

use hydrophonitor_lib::{clean as clean_lib, connect};
Expand Down Expand Up @@ -38,10 +38,11 @@ impl Clean {

if !deployments.is_empty() {
dbg!(deployments);
println!("Do you really want to delete these deployments? (y/n)");
let mut user_input = String::new();
io::stdin().read_line(&mut user_input).with_context(|| "Failed to read line")?;
if !(user_input.contains('y') || user_input.contains('Y')) {

if !Confirm::new()
.with_prompt("Do you really want to delete these deployments? (y/n)")
.default(true)
.interact()? {
println!("Aborting!");
return Ok(());
}
Expand Down

0 comments on commit b73022e

Please sign in to comment.