src/inputs.rs (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
use crate::utils::select_option; pub fn get_commit_type() -> String { let commit_type_options: [&str; 8] = [ "feat", "fix", "docs", "style", "refactor", "test", "chore", "revert", ]; let commit_type_choice: Option<usize> = select_option(&commit_type_options); if commit_type_choice.is_none() { println!("Please choose a commit type"); std::process::exit(1); } let commit_type_choice: String = commit_type_options[commit_type_choice.unwrap()].to_string(); return commit_type_choice; } pub fn get_commit_message() -> String { println!("Please enter a commit message: "); let mut commit_message: String = String::new(); std::io::stdin() .read_line(&mut commit_message) .expect("Failed to read line"); return commit_message; } |