add validation
This commit is contained in:
@@ -40,6 +40,10 @@ fn main() -> anyhow::Result<()> {
|
|||||||
let alphabet = dialoguer::Input::<String>::new()
|
let alphabet = dialoguer::Input::<String>::new()
|
||||||
.with_prompt("Enter alphabet")
|
.with_prompt("Enter alphabet")
|
||||||
.with_initial_text("АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя0123456789 ,.:!?_-+/*='^%#&@$")
|
.with_initial_text("АаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя0123456789 ,.:!?_-+/*='^%#&@$")
|
||||||
|
.validate_with(|input: &String| {
|
||||||
|
let chars = input.chars().collect::<Vec<_>>();
|
||||||
|
util::verify_alphabet(&chars)
|
||||||
|
})
|
||||||
.interact_text()?;
|
.interact_text()?;
|
||||||
let input = dialoguer::Input::<String>::new()
|
let input = dialoguer::Input::<String>::new()
|
||||||
.with_prompt("Enter input")
|
.with_prompt("Enter input")
|
||||||
|
|||||||
Reference in New Issue
Block a user