pub struct Confirm<'a> { /* private fields */ }
Expand description
Renders a confirm prompt.
Example usage
use dialoguer::Confirm;
if Confirm::new().with_prompt("Do you want to continue?").interact()? {
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
Implementations§
source§impl Confirm<'_>
impl Confirm<'_>
sourcepub fn with_prompt<S: Into<String>>(&mut self, prompt: S) -> &mut Self
pub fn with_prompt<S: Into<String>>(&mut self, prompt: S) -> &mut Self
Sets the confirm prompt.
Examples found in repository?
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
fn main() {
let items = &[
"Ice Cream",
"Vanilla Cupcake",
"Chocolate Muffin",
"A Pile of sweet, sweet mustard",
];
let term = Term::buffered_stderr();
let theme = ColorfulTheme::default();
println!("All the following controls are run in a buffered terminal");
Confirm::with_theme(&theme)
.with_prompt("Do you want to continue?")
.interact_on(&term)
.unwrap();
let _: String = Input::with_theme(&theme)
.with_prompt("Your name")
.interact_on(&term)
.unwrap();
Select::with_theme(&theme)
.with_prompt("Pick an item")
.items(items)
.interact_on(&term)
.unwrap();
MultiSelect::with_theme(&theme)
.with_prompt("Pick some items")
.items(items)
.interact_on(&term)
.unwrap();
Sort::with_theme(&theme)
.with_prompt("Order these items")
.items(items)
.interact_on(&term)
.unwrap();
}
More examples
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
fn init_config() -> Result<Option<Config>, Box<dyn Error>> {
let theme = ColorfulTheme {
values_style: Style::new().yellow().dim(),
..ColorfulTheme::default()
};
println!("Welcome to the setup wizard");
if !Confirm::with_theme(&theme)
.with_prompt("Do you want to continue?")
.interact()?
{
return Ok(None);
}
let interface = Input::with_theme(&theme)
.with_prompt("Interface")
.default("127.0.0.1".parse().unwrap())
.interact()?;
let hostname = Input::with_theme(&theme)
.with_prompt("Hostname")
.interact()?;
let tls = Select::with_theme(&theme)
.with_prompt("Configure TLS")
.default(0)
.item("automatic with ACME")
.item("manual")
.item("no")
.interact()?;
let (private_key, cert, use_acme) = match tls {
0 => (Some("acme.pkey".into()), Some("acme.cert".into()), true),
1 => (
Some(
Input::with_theme(&theme)
.with_prompt(" Path to private key")
.interact()?,
),
Some(
Input::with_theme(&theme)
.with_prompt(" Path to certificate")
.interact()?,
),
false,
),
_ => (None, None, false),
};
Ok(Some(Config {
hostname,
interface,
private_key,
cert,
use_acme,
}))
}
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
fn main() {
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you want to continue?")
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really want to continue?")
.default(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really want to continue?")
.default(true)
.show_default(false)
.wait_for_newline(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really want to continue?")
.wait_for_newline(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
match Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really really want to continue?")
.interact_opt()
.unwrap()
{
Some(true) => println!("Looks like you want to continue"),
Some(false) => println!("nevermind then :("),
None => println!("Ok, we can start over later"),
}
match Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really really really want to continue?")
.default(true)
.wait_for_newline(true)
.interact_opt()
.unwrap()
{
Some(true) => println!("Looks like you want to continue"),
Some(false) => println!("nevermind then :("),
None => println!("Ok, we can start over later"),
}
}
sourcepub fn report(&mut self, val: bool) -> &mut Self
pub fn report(&mut self, val: bool) -> &mut Self
Indicates whether or not to report the chosen selection after interaction.
The default is to report the chosen selection.
pub fn with_text(&mut self, text: &str) -> &mut Self
sourcepub fn wait_for_newline(&mut self, wait: bool) -> &mut Self
pub fn wait_for_newline(&mut self, wait: bool) -> &mut Self
Sets when to react to user input.
When false
(default), we check on each user keystroke immediately as
it is typed. Valid inputs can be one of ‘y’, ‘n’, or a newline to accept
the default.
When true
, the user must type their choice and hit the Enter key before
proceeding. Valid inputs can be “yes”, “no”, “y”, “n”, or an empty string
to accept the default.
Examples found in repository?
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
fn main() {
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you want to continue?")
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really want to continue?")
.default(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really want to continue?")
.default(true)
.show_default(false)
.wait_for_newline(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really want to continue?")
.wait_for_newline(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
match Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really really want to continue?")
.interact_opt()
.unwrap()
{
Some(true) => println!("Looks like you want to continue"),
Some(false) => println!("nevermind then :("),
None => println!("Ok, we can start over later"),
}
match Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really really really want to continue?")
.default(true)
.wait_for_newline(true)
.interact_opt()
.unwrap()
{
Some(true) => println!("Looks like you want to continue"),
Some(false) => println!("nevermind then :("),
None => println!("Ok, we can start over later"),
}
}
sourcepub fn default(&mut self, val: bool) -> &mut Self
pub fn default(&mut self, val: bool) -> &mut Self
Sets a default.
Out of the box the prompt does not have a default and will continue to display until the user inputs something and hits enter. If a default is set the user can instead accept the default with enter.
Examples found in repository?
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
fn main() {
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you want to continue?")
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really want to continue?")
.default(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really want to continue?")
.default(true)
.show_default(false)
.wait_for_newline(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really want to continue?")
.wait_for_newline(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
match Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really really want to continue?")
.interact_opt()
.unwrap()
{
Some(true) => println!("Looks like you want to continue"),
Some(false) => println!("nevermind then :("),
None => println!("Ok, we can start over later"),
}
match Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really really really want to continue?")
.default(true)
.wait_for_newline(true)
.interact_opt()
.unwrap()
{
Some(true) => println!("Looks like you want to continue"),
Some(false) => println!("nevermind then :("),
None => println!("Ok, we can start over later"),
}
}
sourcepub fn show_default(&mut self, val: bool) -> &mut Self
pub fn show_default(&mut self, val: bool) -> &mut Self
Disables or enables the default value display.
The default is to append the default value to the prompt to tell the user.
Examples found in repository?
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
fn main() {
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you want to continue?")
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really want to continue?")
.default(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really want to continue?")
.default(true)
.show_default(false)
.wait_for_newline(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really want to continue?")
.wait_for_newline(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
match Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really really want to continue?")
.interact_opt()
.unwrap()
{
Some(true) => println!("Looks like you want to continue"),
Some(false) => println!("nevermind then :("),
None => println!("Ok, we can start over later"),
}
match Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really really really want to continue?")
.default(true)
.wait_for_newline(true)
.interact_opt()
.unwrap()
{
Some(true) => println!("Looks like you want to continue"),
Some(false) => println!("nevermind then :("),
None => println!("Ok, we can start over later"),
}
}
sourcepub fn interact(&self) -> Result<bool>
pub fn interact(&self) -> Result<bool>
Enables user interaction and returns the result.
The dialog is rendered on stderr.
Result contains bool
if user answered “yes” or “no” or default
(configured in default
if pushes enter.
This unlike interact_opt
does not allow to quit with ‘Esc’ or ‘q’.
Examples found in repository?
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
fn init_config() -> Result<Option<Config>, Box<dyn Error>> {
let theme = ColorfulTheme {
values_style: Style::new().yellow().dim(),
..ColorfulTheme::default()
};
println!("Welcome to the setup wizard");
if !Confirm::with_theme(&theme)
.with_prompt("Do you want to continue?")
.interact()?
{
return Ok(None);
}
let interface = Input::with_theme(&theme)
.with_prompt("Interface")
.default("127.0.0.1".parse().unwrap())
.interact()?;
let hostname = Input::with_theme(&theme)
.with_prompt("Hostname")
.interact()?;
let tls = Select::with_theme(&theme)
.with_prompt("Configure TLS")
.default(0)
.item("automatic with ACME")
.item("manual")
.item("no")
.interact()?;
let (private_key, cert, use_acme) = match tls {
0 => (Some("acme.pkey".into()), Some("acme.cert".into()), true),
1 => (
Some(
Input::with_theme(&theme)
.with_prompt(" Path to private key")
.interact()?,
),
Some(
Input::with_theme(&theme)
.with_prompt(" Path to certificate")
.interact()?,
),
false,
),
_ => (None, None, false),
};
Ok(Some(Config {
hostname,
interface,
private_key,
cert,
use_acme,
}))
}
More examples
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
fn main() {
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you want to continue?")
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really want to continue?")
.default(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really want to continue?")
.default(true)
.show_default(false)
.wait_for_newline(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really want to continue?")
.wait_for_newline(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
match Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really really want to continue?")
.interact_opt()
.unwrap()
{
Some(true) => println!("Looks like you want to continue"),
Some(false) => println!("nevermind then :("),
None => println!("Ok, we can start over later"),
}
match Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really really really want to continue?")
.default(true)
.wait_for_newline(true)
.interact_opt()
.unwrap()
{
Some(true) => println!("Looks like you want to continue"),
Some(false) => println!("nevermind then :("),
None => println!("Ok, we can start over later"),
}
}
sourcepub fn interact_opt(&self) -> Result<Option<bool>>
pub fn interact_opt(&self) -> Result<Option<bool>>
Enables user interaction and returns the result.
The dialog is rendered on stderr.
Result contains Some(bool)
if user answered “yes” or “no” or Some(default)
(configured in default
) if pushes enter,
or None
if user cancelled with ‘Esc’ or ‘q’.
Examples found in repository?
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
fn main() {
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you want to continue?")
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really want to continue?")
.default(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really want to continue?")
.default(true)
.show_default(false)
.wait_for_newline(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really want to continue?")
.wait_for_newline(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
match Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really really want to continue?")
.interact_opt()
.unwrap()
{
Some(true) => println!("Looks like you want to continue"),
Some(false) => println!("nevermind then :("),
None => println!("Ok, we can start over later"),
}
match Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really really really want to continue?")
.default(true)
.wait_for_newline(true)
.interact_opt()
.unwrap()
{
Some(true) => println!("Looks like you want to continue"),
Some(false) => println!("nevermind then :("),
None => println!("Ok, we can start over later"),
}
}
sourcepub fn interact_on(&self, term: &Term) -> Result<bool>
pub fn interact_on(&self, term: &Term) -> Result<bool>
Like interact but allows a specific terminal to be set.
Examples
use dialoguer::Confirm;
use console::Term;
let proceed = Confirm::new()
.with_prompt("Do you wish to continue?")
.interact_on(&Term::stderr())?;
Examples found in repository?
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
fn main() {
let items = &[
"Ice Cream",
"Vanilla Cupcake",
"Chocolate Muffin",
"A Pile of sweet, sweet mustard",
];
let term = Term::buffered_stderr();
let theme = ColorfulTheme::default();
println!("All the following controls are run in a buffered terminal");
Confirm::with_theme(&theme)
.with_prompt("Do you want to continue?")
.interact_on(&term)
.unwrap();
let _: String = Input::with_theme(&theme)
.with_prompt("Your name")
.interact_on(&term)
.unwrap();
Select::with_theme(&theme)
.with_prompt("Pick an item")
.items(items)
.interact_on(&term)
.unwrap();
MultiSelect::with_theme(&theme)
.with_prompt("Pick some items")
.items(items)
.interact_on(&term)
.unwrap();
Sort::with_theme(&theme)
.with_prompt("Order these items")
.items(items)
.interact_on(&term)
.unwrap();
}
sourcepub fn interact_on_opt(&self, term: &Term) -> Result<Option<bool>>
pub fn interact_on_opt(&self, term: &Term) -> Result<Option<bool>>
Like interact_opt
but allows a specific terminal to be set.
Examples
use dialoguer::Confirm;
use console::Term;
fn main() -> std::io::Result<()> {
let confirmation = Confirm::new()
.interact_on_opt(&Term::stdout())?;
match confirmation {
Some(answer) => println!("User answered {}", if answer { "yes" } else { "no " }),
None => println!("User did not answer")
}
Ok(())
}
source§impl<'a> Confirm<'a>
impl<'a> Confirm<'a>
sourcepub fn with_theme(theme: &'a dyn Theme) -> Self
pub fn with_theme(theme: &'a dyn Theme) -> Self
Creates a confirm prompt with a specific theme.
Examples
use dialoguer::{
Confirm,
theme::ColorfulTheme
};
let proceed = Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you wish to continue?")
.interact()?;
Examples found in repository?
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
fn main() {
let items = &[
"Ice Cream",
"Vanilla Cupcake",
"Chocolate Muffin",
"A Pile of sweet, sweet mustard",
];
let term = Term::buffered_stderr();
let theme = ColorfulTheme::default();
println!("All the following controls are run in a buffered terminal");
Confirm::with_theme(&theme)
.with_prompt("Do you want to continue?")
.interact_on(&term)
.unwrap();
let _: String = Input::with_theme(&theme)
.with_prompt("Your name")
.interact_on(&term)
.unwrap();
Select::with_theme(&theme)
.with_prompt("Pick an item")
.items(items)
.interact_on(&term)
.unwrap();
MultiSelect::with_theme(&theme)
.with_prompt("Pick some items")
.items(items)
.interact_on(&term)
.unwrap();
Sort::with_theme(&theme)
.with_prompt("Order these items")
.items(items)
.interact_on(&term)
.unwrap();
}
More examples
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
fn init_config() -> Result<Option<Config>, Box<dyn Error>> {
let theme = ColorfulTheme {
values_style: Style::new().yellow().dim(),
..ColorfulTheme::default()
};
println!("Welcome to the setup wizard");
if !Confirm::with_theme(&theme)
.with_prompt("Do you want to continue?")
.interact()?
{
return Ok(None);
}
let interface = Input::with_theme(&theme)
.with_prompt("Interface")
.default("127.0.0.1".parse().unwrap())
.interact()?;
let hostname = Input::with_theme(&theme)
.with_prompt("Hostname")
.interact()?;
let tls = Select::with_theme(&theme)
.with_prompt("Configure TLS")
.default(0)
.item("automatic with ACME")
.item("manual")
.item("no")
.interact()?;
let (private_key, cert, use_acme) = match tls {
0 => (Some("acme.pkey".into()), Some("acme.cert".into()), true),
1 => (
Some(
Input::with_theme(&theme)
.with_prompt(" Path to private key")
.interact()?,
),
Some(
Input::with_theme(&theme)
.with_prompt(" Path to certificate")
.interact()?,
),
false,
),
_ => (None, None, false),
};
Ok(Some(Config {
hostname,
interface,
private_key,
cert,
use_acme,
}))
}
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
fn main() {
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you want to continue?")
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really want to continue?")
.default(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really want to continue?")
.default(true)
.show_default(false)
.wait_for_newline(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
if Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really want to continue?")
.wait_for_newline(true)
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
match Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really really want to continue?")
.interact_opt()
.unwrap()
{
Some(true) => println!("Looks like you want to continue"),
Some(false) => println!("nevermind then :("),
None => println!("Ok, we can start over later"),
}
match Confirm::with_theme(&ColorfulTheme::default())
.with_prompt("Do you really really really really really want to continue?")
.default(true)
.wait_for_newline(true)
.interact_opt()
.unwrap()
{
Some(true) => println!("Looks like you want to continue"),
Some(false) => println!("nevermind then :("),
None => println!("Ok, we can start over later"),
}
}