feat: add dialoguer-demo

This commit is contained in:
2024-01-11 00:34:20 +08:00
parent fe5c16450c
commit 47830618e4
3 changed files with 294 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
use dialoguer::Select;
use dialoguer::theme::ColorfulTheme;
fn main() {
let items = vec!["foo", "bar", "baz"];
let selection = Select::with_theme(&ColorfulTheme::default())
.with_prompt("What do you choose?")
.items(&items)
.default(0)
.clear(true)
.report(false)
.interact()
.unwrap();
println!("You chose: {}", items[selection]);
}