Skip to content

Commit

Permalink
change: better commit types (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlienard authored Mar 30, 2024
1 parent 33a197f commit 7dff0f0
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,21 @@ impl Config {
.prompt()?;

let type_options: Vec<&str> = vec![
"feat", "fix", "refactor", "perf", "style", "test", "docs", "build", "ops", "chore",
"feat Add a new feature",
"fix Correct a bug or error",
"change Change an existing feature",
"refactor Restructure existing code without altering the product behavior",
"chore Routine task, maintenance, or project management that does not directly modify the source code",
"test Add missing tests or correcting existing tests",
"docs Update or create documentation",
"ci Changes related to continuous integration or build environment configuration",
"remove Removal of obsolete or unnecessary code, files, or features",
"perf Improvement of code performance without changing its external behavior",
"revert Complete or partial reversal of a previous commit",
];

let _type = Select::new("Type:", type_options).prompt()?;
let _type = _type.split_whitespace().collect::<Vec<&str>>()[0];

let scope = Text::new("Scope (optional):").prompt_skippable()?;

Expand All @@ -123,7 +134,7 @@ impl Config {
};

let splited_branch = linear_branch.split('-').collect::<Vec<&str>>();
if splited_branch.len() > 1 {
if splited_branch.len() > 1 && splited_branch[1].parse::<u32>().is_ok() {
pr_name = format!(
"{} [{}-{}]",
pr_name,
Expand Down

0 comments on commit 7dff0f0

Please sign in to comment.