Skip to content

Commit

Permalink
Add docs for CLI orphan fragments (#589)
Browse files Browse the repository at this point in the history
* Add docs for CLI orphan fragments
Refs #584

* Add newsfragment

* Mention orphan fragments in doc

* Add a note about '+' to the create command's docstring
  • Loading branch information
SmileyChris authored Apr 26, 2024
1 parent 914b446 commit 2908a62
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ If the fragments directory does not exist, it will be created.
If the filename exists already, ``towncrier create`` will add (and then increment) a number after the fragment type until it finds a filename that does not exist yet.
In the above example, it will generate ``123.bugfix.1.rst`` if ``123.bugfix.rst`` already exists.

To create a news fragment not tied to a specific issue (which towncrier calls an "orphan fragment"), start the fragment name with a ``+``.
If that is the entire fragment name, a random hash will be added for you::

$ towncrier create +.feature.rst
$ ls newsfragments/
+fcc4dc7b.feature.rst

.. option:: --content, -c CONTENT

A string to use for content.
Expand Down
3 changes: 3 additions & 0 deletions src/towncrier/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ def _main(
* .doc - a documentation improvement,
* .removal - a deprecation or removal of public API,
* .misc - a ticket has been closed, but it is not of interest to users.
If the FILENAME base is just '+' (to create a fragment not tied to an
issue), it will be appended with a random hex string.
"""
__main(ctx, directory, config, filename, edit, content)

Expand Down
1 change: 1 addition & 0 deletions src/towncrier/newsfragments/589.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add docs to explain how ``towncrier create +.feature.rst`` (orphan fragments) works.

0 comments on commit 2908a62

Please sign in to comment.