-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code making decision to remove prompt or keep news fragments is being kept in new intermediate function _remover.remove_news_fragment_files
- Loading branch information
Showing
3 changed files
with
37 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright (c) Amber Brown, 2015 | ||
# See LICENSE for details. | ||
|
||
from __future__ import annotations | ||
|
||
import click | ||
|
||
from towncrier._git import remove_files | ||
|
||
|
||
def remove_news_fragment_files( | ||
fragment_filenames: list[str], answer_yes: bool, answer_keep: bool | ||
) -> None: | ||
try: | ||
if answer_keep: | ||
click.echo("Keeping the following files:") | ||
# Not proceeding with the removal of the files. | ||
return | ||
|
||
if answer_yes: | ||
click.echo("Removing the following files:") | ||
else: | ||
click.echo("I want to remove the following files:") | ||
finally: | ||
# Will always be printed, even for answer_keep to help with possible troubleshooting | ||
for filename in fragment_filenames: | ||
click.echo(filename) | ||
|
||
if answer_yes or click.confirm("Is it okay if I remove those files?", default=True): | ||
remove_files(fragment_filenames) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters