aboutsummaryrefslogtreecommitdiff
path: root/vendor/dialoguer/examples/input.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
committerValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
commita990de90fe41456a23e58bd087d2f107d321f3a1 (patch)
tree15afc392522a9e85dc3332235e311b7d39352ea9 /vendor/dialoguer/examples/input.rs
parent3d48cd3f81164bbfc1a755dc1d4a9a02f98c8ddd (diff)
downloadfparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.tar.xz
fparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.zip
Deleted vendor folder
Diffstat (limited to 'vendor/dialoguer/examples/input.rs')
-rw-r--r--vendor/dialoguer/examples/input.rs44
1 files changed, 0 insertions, 44 deletions
diff --git a/vendor/dialoguer/examples/input.rs b/vendor/dialoguer/examples/input.rs
deleted file mode 100644
index 8691c2e..0000000
--- a/vendor/dialoguer/examples/input.rs
+++ /dev/null
@@ -1,44 +0,0 @@
-use dialoguer::{theme::ColorfulTheme, Input};
-
-fn main() {
- let input: String = Input::with_theme(&ColorfulTheme::default())
- .with_prompt("Your name")
- .interact_text()
- .unwrap();
-
- println!("Hello {}!", input);
-
- let mail: String = Input::with_theme(&ColorfulTheme::default())
- .with_prompt("Your email")
- .validate_with({
- let mut force = None;
- move |input: &String| -> Result<(), &str> {
- if input.contains('@') || force.as_ref().map_or(false, |old| old == input) {
- Ok(())
- } else {
- force = Some(input.clone());
- Err("This is not a mail address; type the same value again to force use")
- }
- }
- })
- .interact_text()
- .unwrap();
-
- println!("Email: {}", mail);
-
- let mail: String = Input::with_theme(&ColorfulTheme::default())
- .with_prompt("Your planet")
- .default("Earth".to_string())
- .interact_text()
- .unwrap();
-
- println!("Planet: {}", mail);
-
- let mail: String = Input::with_theme(&ColorfulTheme::default())
- .with_prompt("Your galaxy")
- .with_initial_text("Milky Way".to_string())
- .interact_text()
- .unwrap();
-
- println!("Galaxy: {}", mail);
-}