diff --git a/src/towncrier/create.py b/src/towncrier/create.py index a3d5a66d..549da6a8 100644 --- a/src/towncrier/create.py +++ b/src/towncrier/create.py @@ -45,11 +45,6 @@ default=DEFAULT_CONTENT, help="Sets the content of the new fragment.", ) -@click.option( - "--eof-newline/--no-eof-newline", - default=None, - help="Ensure the content ends with an empty line.", -) @click.argument("filename", default="") def _main( ctx: click.Context, @@ -58,7 +53,6 @@ def _main( filename: str, edit: bool | None, content: str, - eof_newline: bool | None, ) -> None: """ Create a new news fragment. @@ -76,7 +70,7 @@ def _main( * .removal - a deprecation or removal of public API, * .misc - a ticket has been closed, but it is not of interest to users. """ - __main(ctx, directory, config, filename, edit, content, eof_newline) + __main(ctx, directory, config, filename, edit, content) def __main( @@ -86,14 +80,11 @@ def __main( filename: str, edit: bool | None, content: str, - eof_newline: bool | None, ) -> None: """ The main entry point. """ base_directory, config = load_config_from_options(directory, config_path) - if eof_newline is None: - eof_newline = config.create_eof_newline filename_ext = "" if config.create_add_extension: @@ -178,7 +169,7 @@ def __main( with open(segment_file, "w") as f: f.write(content) - if eof_newline and content and not content.endswith("\n"): + if config.create_eof_newline and content and not content.endswith("\n"): f.write("\n") click.echo(f"Created news fragment at {segment_file}") diff --git a/src/towncrier/newsfragments/482.feature.rst b/src/towncrier/newsfragments/482.feature.rst index 892ced81..81b66604 100644 --- a/src/towncrier/newsfragments/482.feature.rst +++ b/src/towncrier/newsfragments/482.feature.rst @@ -2,4 +2,4 @@ If no filename is given when doing ``towncrier`` create, interactively ask for t Now by default, when creating a fragment it will be appended with the ``filename`` option's extension (unless an extension is explicitly provided). For example, ``towncrier create 123.feature`` will create ``news/123.feature.rst``. This can be changed in configuration file by setting `add_extension = false`. -A new line is now added by default to the end of the fragment contents. This can be reverted in the configuration file by setting `add_newline = false` or explicitly set with the ``create`` command line flags ``--eof-newline/--no-eof-newline``. +A new line is now added by default to the end of the fragment contents. This can be reverted in the configuration file by setting `add_newline = false`. diff --git a/src/towncrier/test/test_create.py b/src/towncrier/test/test_create.py index acab2666..e946f201 100644 --- a/src/towncrier/test/test_create.py +++ b/src/towncrier/test/test_create.py @@ -117,19 +117,6 @@ def test_content_without_eof_newline(self): eof_newline=False, ) - def test_content_no_eof_newline_arg(self): - """ - When creating a new fragment the content can be passed as a command line - argument. The text editor is not invoked, and no eof newline is added if the - --no-eof-newline argument is passed. - """ - content_line = "This is a content" - self._test_success( - content=[content_line], - additional_args=["-c", content_line, "--no-eof-newline"], - eof_newline=False, - ) - def test_message_and_edit(self): """ When creating a new message, a initial content can be passed via