Request confirmation from the user Displays a yes/no prompt with the given message and returns the user's choice. If `accept_defaults` is true, automatically returns false without prompting.
(&mut self, message: &str)
| 304 | /// Displays a yes/no prompt with the given message and returns the user's choice. |
| 305 | /// If `accept_defaults` is true, automatically returns false without prompting. |
| 306 | fn confirm(&mut self, message: &str) -> Result<bool> { |
| 307 | println!("\n{} {}", style(PROMPT_PREFIX).yellow(), style(message).yellow().bold()); |
| 308 | |
| 309 | if self.args.accept_defaults { |
| 310 | return Ok(false); |
| 311 | } |
| 312 | |
| 313 | let theme = dialoguer::theme::ColorfulTheme::default(); |
| 314 | Ok(Confirm::with_theme(&theme).with_prompt("").default(false).interact()?) |
| 315 | } |
| 316 | |
| 317 | /// Request text input from the user |
| 318 | /// |