Read A Single Character From The Command Line In Rust
This is for a confirmation prompt using the dialoguer
crate.
use dialoguer::Confirm;
pub fn main() {
if Confirm::new()
.with_prompt("Do you want to continue?")
.interact()
.unwrap()
{
println!("Looks like you want to continue");
} else {
println!("nevermind then :(");
}
}
It took me a while to find this. The references below show some of the things I went through looking for the solution.
-- end of line --
References
-
-
-
-
-
-
-
-
-
-
-
-
This was the key to getting things to work
-
indicatif is a library for Rust that helps you build command line interfaces that report progress to users. It comes with various tools and utilities for formatting anything that indicates progress.
-
console is a library for Rust that provides access to various terminal features so you can build nicer looking command line interfaces. It comes with various tools and utilities for working with Terminals and formatting text.
-
-
-