hello_prompt/
hello_prompt.rs1use cli_ui::prompt::prelude::*;
11
12fn main() {
13 intro("Set up a new project");
14
15 let name = text("What's your name?")
16 .default("Anya") .placeholder("e.g. Anya") .run()
19 .or_cancel("Cancelled.");
20
21 let stack = select("Pick a stack")
22 .option("rust", "Rust")
23 .option("ts", "TypeScript")
24 .option("py", "Python")
25 .run()
26 .or_cancel("Cancelled.");
27
28 let init_git = confirm("Initialise git?")
29 .default(true)
30 .run()
31 .or_cancel("Cancelled.");
32
33 outro(format!(
34 "{name} → {} ({} git)",
35 stack.label,
36 if init_git { "with" } else { "without" }
37 ));
38}