From eeb9de0ebcbe8bb0ebc1ad9d0fe89307def5aff3 Mon Sep 17 00:00:00 2001 From: lionarius Date: Fri, 13 Sep 2024 09:52:03 +0300 Subject: [PATCH] add validation --- src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main.rs b/src/main.rs index e8c1e4c..57b2ded 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,6 +40,10 @@ fn main() -> anyhow::Result<()> { let alphabet = dialoguer::Input::::new() .with_prompt("Enter alphabet") .with_initial_text("АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя0123456789 ,.:!?_-+/*='^%#&@$") + .validate_with(|input: &String| { + let chars = input.chars().collect::>(); + util::verify_alphabet(&chars) + }) .interact_text()?; let input = dialoguer::Input::::new() .with_prompt("Enter input")