Skip to content

Commit

Permalink
feat: add suggested descriptions for each commit type
Browse files Browse the repository at this point in the history
  • Loading branch information
rzmk committed Nov 30, 2023
1 parent 7bc9aac commit 5169c4b
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,24 @@ fn main() {

// Commit Type
let commit_type_options = vec![
"build", "ci", "chore", "docs", "feat", "fix", "perf", "refactor", "test",
"build - build system and dependencies",
"ci - continuous integration",
"chore - misc/maintenance not related to core code",
"docs - documentation changes (e.g., README.md, comments)",
"feat - new feature or significant enhancement",
"fix - bug fix or error correction",
"perf - performance improvement",
"refactor - code restructuring or cleanup",
"test - add or update tests",
];
let commit_type = Select::new("Type:", commit_type_options).prompt();
let commit_type = match commit_type {
Ok(commit_type) => String::from(commit_type),
Ok(commit_type) =>
// Get the first word of the commit type
{
let commit_type = commit_type.split_whitespace().next().unwrap();
commit_type
}
Err(_) => {
println!("No commit type selected, exiting");
return;
Expand All @@ -45,7 +58,7 @@ fn main() {

match confirm {
Ok(true) => {
if run_git_add == true {
if run_git_add {
println!("Running git add -A");
if !dry_run {
let output = Command::new("git")
Expand All @@ -63,7 +76,7 @@ fn main() {
}

println!("Running git commit -m \"{}\"", result_message);
if dry_run == false {
if !dry_run {
let output = Command::new("git")
.args(["commit", "-m", result_message.as_str()])
.output()
Expand Down

0 comments on commit 5169c4b

Please sign in to comment.