Brijesh's Git Server — gitcc @ ad300ff6ff7ba9f0a5c6e9c07e28e635ba7747cb

failed attempt at automatic git workflow

docs: create readme
Brijesh Wawdhane brijesh@wawdhane.com
Mon, 25 Sep 2023 15:14:36 +0530
commit

ad300ff6ff7ba9f0a5c6e9c07e28e635ba7747cb

parent

e842b23b5d9b80521bf8425c845deb83efb13d9f

4 files changed, 25 insertions(+), 8 deletions(-)

jump to
A README.md

@@ -0,0 +1,15 @@

+# GitCC + +A tool to automate git mirrors management and conventional commits + +### Todo + +- [x] Show selection options like conventional commit options like commitizen +- [x] Create new commit +- [x] Push to remote +- [ ] Add new remote + +### Temporary notes + +- [x] Add message to select_option function +- [ ] Make make_commit function's arguments optional
M src/git_actions.rssrc/git_actions.rs

@@ -18,7 +18,7 @@

pub fn confirm_and_stage_all() { let staging_options: [&str; 2] = ["Yes", "No"]; let staging_choice_number: Option<usize> = - select_option("Would you like to stage all files", &staging_options); + select_option("Would you like to stage all files? ", &staging_options); let staging_choice: String = staging_options[staging_choice_number.unwrap()].to_string(); if staging_choice == "Yes" {

@@ -34,7 +34,7 @@ // function to push to remote

pub fn confirm_and_push_to_remote() { let push_options: [&str; 2] = ["Yes", "No"]; let push_choice_number: Option<usize> = - select_option("Would you like to push to remote?", &push_options); + select_option("Would you like to push to remote? ", &push_options); let push_choice: String = push_options[push_choice_number.unwrap()].to_string(); if push_choice == "Yes" {

@@ -47,7 +47,7 @@ remotes.push(remote.unwrap().to_string());

} let remote_choice_number: Option<usize> = - select_option_string_vec("Select a remote to push to", &remotes); + select_option_string_vec("Select a remote to push to ", &remotes); let remote_choice: String = remotes[remote_choice_number.unwrap()].to_string(); // TODO: ask user to choose branch

@@ -66,7 +66,7 @@ pub fn make_initial_commit() {

let commit_message_options: [&str; 2] = ["Use default", "Create custom"]; let commit_message_choice_number: Option<usize> = - select_option("Choose initial commit message", &commit_message_options); + select_option("Choose initial commit message ", &commit_message_options); let commit_message_choice: String = commit_message_options[commit_message_choice_number.unwrap()].to_string();
M src/inputs.rssrc/inputs.rs

@@ -5,8 +5,10 @@ let commit_type_options: [&str; 8] = [

"feat", "fix", "docs", "style", "refactor", "test", "chore", "revert", ]; - let commit_type_choice_number: Option<usize> = - select_option("Select type of change in this commit", &commit_type_options); + let commit_type_choice_number: Option<usize> = select_option( + "Select type of change in this commit ", + &commit_type_options, + ); let commit_type_choice: String = commit_type_options[commit_type_choice_number.unwrap()].to_string();
M src/main.rssrc/main.rs

@@ -22,10 +22,10 @@ if rev_parse_single.is_err() {

println!("No commits yet"); make_initial_commit(); } else { + confirm_and_stage_all(); + let commit_type: String = get_commit_type(); let commit_message: String = get_commit_message(); - - confirm_and_stage_all(); make_commit(commit_type, commit_message); confirm_and_push_to_remote();