pawamoy / git-changelog

Automatic Changelog generator using Jinja2 templates.
https://pawamoy.github.io/git-changelog
ISC License
136 stars 34 forks source link

Altering conventions (e.g., add "sty" for "style" or "enh" as an alternative to "feat") #48

Open oesteban opened 1 year ago

oesteban commented 1 year ago

Is your feature request related to a problem? Please describe. The CLI currently allows little room for flexibility on the convention side. Either being able to provide custom conventions or a utility to add prefixes to sections would be very much appreciated.

pawamoy commented 1 year ago

OK for the feature, I can review PRs if you're willing to send one :slightly_smiling_face:

oesteban commented 1 year ago

I'll gladly contribute, specially after seeing your responsiveness :)

Question before I dive in. Here: https://github.com/pawamoy/git-changelog/blob/86a8f98aee98e426c1371e6e7d439be98a876d9d/src/git_changelog/commit.py#L280-L296 I can see that the commit types are set in the dict, and then the keys are joined together within the regex.

A naive approach would be adding the new keywords and associating them to existing sections, however this is bound to fail since you want to have a single id for the section.

Would it make sense to change this dictionary to tuples of section tuple and lists/tuples of regex tokens like ("Features", ("feat", "enh")]) or ("Style", ("sty(le)?[:\]\ ]")?

pawamoy commented 1 year ago

I'm not sure to understand. If you look at the dict, you'll see that we can have multiple keys (commit type) for the same value (section title), for example test and tests for "Tests", or ref and refactor for "Code Refactoring". Could we not add "sty": "Style" and "enh": "Features" to the dict dynamically?

oesteban commented 1 year ago

Right, sorry for my sloppiness when looking at it. Good I asked - then this PR can focus on enabling the CLI to have a language for these additions.

pawamoy commented 1 year ago

No worries! Yep, sounds right :slightly_smiling_face: