Skip to content

Commit

Permalink
fix: Always output release notes to stdout
Browse files Browse the repository at this point in the history
Issue #65: #65
  • Loading branch information
pawamoy committed Nov 4, 2023
1 parent 0edda2e commit 1e44bca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/git_changelog/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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]
Expand All @@ -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

Expand Down

0 comments on commit 1e44bca

Please sign in to comment.