Skip to content

Commit 5169c4b

Browse files
author
rzmk
committed
feat: add suggested descriptions for each commit type
1 parent 7bc9aac commit 5169c4b

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/main.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,24 @@ fn main() {
1616

1717
// Commit Type
1818
let commit_type_options = vec![
19-
"build", "ci", "chore", "docs", "feat", "fix", "perf", "refactor", "test",
19+
"build - build system and dependencies",
20+
"ci - continuous integration",
21+
"chore - misc/maintenance not related to core code",
22+
"docs - documentation changes (e.g., README.md, comments)",
23+
"feat - new feature or significant enhancement",
24+
"fix - bug fix or error correction",
25+
"perf - performance improvement",
26+
"refactor - code restructuring or cleanup",
27+
"test - add or update tests",
2028
];
2129
let commit_type = Select::new("Type:", commit_type_options).prompt();
2230
let commit_type = match commit_type {
23-
Ok(commit_type) => String::from(commit_type),
31+
Ok(commit_type) =>
32+
// Get the first word of the commit type
33+
{
34+
let commit_type = commit_type.split_whitespace().next().unwrap();
35+
commit_type
36+
}
2437
Err(_) => {
2538
println!("No commit type selected, exiting");
2639
return;
@@ -45,7 +58,7 @@ fn main() {
4558

4659
match confirm {
4760
Ok(true) => {
48-
if run_git_add == true {
61+
if run_git_add {
4962
println!("Running git add -A");
5063
if !dry_run {
5164
let output = Command::new("git")
@@ -63,7 +76,7 @@ fn main() {
6376
}
6477

6578
println!("Running git commit -m \"{}\"", result_message);
66-
if dry_run == false {
79+
if !dry_run {
6780
let output = Command::new("git")
6881
.args(["commit", "-m", result_message.as_str()])
6982
.output()

0 commit comments

Comments
 (0)