Add confirmation to init

This commit is contained in:
SkyfallWasTaken 2024-07-15 18:24:32 +01:00
parent bf87587aae
commit 9b7fbcfc06

View file

@ -2,7 +2,7 @@ use std::env;
use camino::Utf8PathBuf; use camino::Utf8PathBuf;
use color_eyre::Result; use color_eyre::Result;
use dialoguer::{theme::ColorfulTheme, Input}; use dialoguer::{theme::ColorfulTheme, Confirm, Input};
use gix_config::File as GitConfigFile; use gix_config::File as GitConfigFile;
pub async fn init() -> Result<()> { pub async fn init() -> Result<()> {
@ -72,5 +72,15 @@ pub async fn init() -> Result<()> {
license license
); );
let yes = Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Is this okay?")
.default(true)
.interact()?;
if yes {
println!("Writing.")
} else {
println!("Cancelled.")
}
Ok(()) Ok(())
} }