This commit is contained in:
AnthonyMichaelTDM
2022-03-09 13:25:36 -08:00
parent 93fdf644aa
commit 6ba0a2d7e2

View File

@@ -42,7 +42,7 @@ fn main() {
//ask user how they want the todo list formatted
format_game_first = get_yn_from_user("\n\t---====FORMATS====---\ngame first:\n\tGame\n\t\tLanguage ✅/⬜️\n\nlang first:\n\tLanguage\n\t\tGame ✅/⬜️\n\nmake todo list using the game first format? (y/n)");
format_game_first = get_yn_from_user("\n\t---====FORMATS====---\ngame first:\n\tGame\n\t\tLanguage ✅/⬜️\n\nlang first:\n\tLanguage\n\t\tGame ✅/⬜️\n\nmake todo list using the game first format? (y/n | default No) ");
//get all folders in ROOT_DIR
root_folders = Vec::new();
@@ -209,8 +209,14 @@ fn get_str_from_user(prompt:&str) -> String {
* gets a boolean from user
*/
fn get_yn_from_user(prompt:&str) -> bool {
//DATA
let input = get_str_from_user(prompt);
//default in case of error
if input.is_empty() {return false;}
//get and parse input
match &get_str_from_user(prompt)[0..1] { //get first character
match &input[0..1] { //get first character
"y" | "Y" => return true,
_ => return false,
}