diff --git a/src/git_changelog/cli.py b/src/git_changelog/cli.py index b5ecd4b..a1db8cf 100644 --- a/src/git_changelog/cli.py +++ b/src/git_changelog/cli.py @@ -643,7 +643,7 @@ def output_release_notes( input_file: str = "CHANGELOG.md", version_regex: str = DEFAULT_VERSION_REGEX, marker_line: str = DEFAULT_MARKER_LINE, - output_file: str | TextIO = sys.stdout, + output_file: str | TextIO | None = None, ) -> None: """Print release notes from existing changelog. @@ -655,6 +655,7 @@ def output_release_notes( marker_line: The insertion marker line in the changelog. output_file: Where to print/write the release notes. """ + output_file = output_file or sys.stdout release_notes = get_release_notes(input_file, version_regex, marker_line) try: output_file.write(release_notes) # type: ignore[union-attr] @@ -681,7 +682,7 @@ def main(args: list[str] | None = None) -> int: input_file=settings["input"], version_regex=settings["version_regex"], marker_line=settings["marker_line"], - output_file=settings["output"], + output_file=None, # force writing to stdout ) return 0