twisted / towncrier

Manage the release notes for your project.
https://towncrier.readthedocs.io
MIT License
776 stars 120 forks source link

Section aware create #603

Closed SmileyChris closed 3 months ago

SmileyChris commented 4 months ago

Description

towncrier create should work better with sections if defined in the configuration file.

This adds a new towncrier create --section <section name> option, or if you're using the new interactive create then you'll be asked for the section if there are multiple ones defined in your config:

$ towncrier create --content "Sections!"
Pick a section
 1. Backend
 2. Frontend
Section (1, 2) [1]: 2
Issue number (`+` for none): 603
Fragment type (feature, bugfix, doc, removal, misc): feature
Created news fragment at /home/chris/demo/changes/frontend/603.feature.rst

If you use sections and none have an empty path, you must now specify the section when creating a new news fragment (if one does have an empty path, that section will be used by default).

This PR also deduplicates the code that determines the base fragment path which was done in three places!

Checklist

adiroiban commented 4 months ago

Thanks for the PR. I am not using the create command, so there is not much UI/UX feedback I can provide.

As long as you are happy with the behaviour, we can merge it.


I am tring to understand what "sections" is in the context of towncrier.

I am reading something about it here https://towncrier.readthedocs.io/en/latest/configuration.html#sections

Especially the part from Section Path Behaviour is confusing.

I think that it needs better example.

For example

If directory is not set, “newsfragments” is added to the end of each path. For example, with the above sections, the paths would be:

Which directory , I guess that this is [tool.towncrier] -> directory

Are people using this behaviour ?

To me, this all seems very confusing.