-
-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change scope with commit_parsers #50
Comments
I took a look through the code and have an idea of how this might be implemented. Are you interested in a PR to address this? I'm open to advice/guidance on how you might like to see this implemented. |
Hello, thanks for the nice suggestion! It definitely makes sense to support overriding the scope of commits.
Sure, that'd be nice. The current workflow is:
git-cliff/git-cliff-core/src/commit.rs Lines 122 to 123 in 2be04f8
git-cliff/git-cliff-core/src/commit.rs Line 200 in 2be04f8
So first, I'd rename And then while serializing, you can construct a logic like this: commit.serialize_field(
"scope",
&self.scope.as_deref().or_else(|| conv.scope().map(|v| v.as_str())).or(self.default_scope.as_deref())
)?; This will first check if there is a custom scope set, then tries to get the scope from conventional parser and then uses the default scope as a last resort. This is how I'd implement it. Unfortunately, having |
Thanks for the thoughtful reply! No promises on a timeline but I'll take a crack at this soon and see if I can't get something pushed and reviewed. Thank you again! |
No problem! Let me know if there is something that I can help with. |
I will be working on this for the upcoming release if no one wants to dive into it 🐻 LMK |
* fix: issue #50 * chore: Check some lints and styles * docs: add scope example * chore: fix some typos in cargo docs * style: rerun cargo fmt and cargo lint * style(config): update wording in the comment * test(config): add tests about specifying the scope * test(fixture): add test fixture for custom scope Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
Is your feature request related to a problem? Please describe.
In a monorepo, I that have a folder with the name "www", however, since I am using git-cliff to generate a public-facing changelog, I would wish for this to be displayed as "Application" when generated.
I am using template replace functions to replace "www" with "Application" but would like the ability to change this in the
commit_parsers
.Describe the solution you'd like
commit_parsers
should allow changing of the scope on-demand. For example:Describe alternatives you've considered
N/A
Additional context
Thanks for an awesome project!
The text was updated successfully, but these errors were encountered: