Brijesh's Git Server — gitcc @ 989a633d27f73f5b5eb5af65a3ef109db8a1cf07

failed attempt at automatic git workflow

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
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_number: Option<usize> = select_option(&commit_type_options);

    let commit_type_choice: String = commit_type_options[commit_type_choice_number.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;
}