Skip to content

Commit

Permalink
add scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
TNTwise committed Nov 26, 2024
1 parent 719fa29 commit 69d9ade
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/printchangelog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import sys

def get_latest_tag(changelog):
with open(changelog, 'r') as file:
lines = file.readlines()

tags = []
for index, line in enumerate(lines):
if line.startswith('# '):
tags.append((index, line.strip('# ').strip()))

if not tags:
print("No tags found.")
return

start_index, latest_tag = tags[0]
end_index = tags[1][0] if len(tags) > 1 else len(lines)
content = ''.join(lines[start_index:end_index])

print(content)

if __name__ == "__main__":
changelog_file = 'CHANGELOG.md'
if len(sys.argv) > 1:
changelog_file = sys.argv[1]
get_latest_tag(changelog_file)

0 comments on commit 69d9ade

Please sign in to comment.