From cf25a22641a446f59c885a5f5d27a443490d3427 Mon Sep 17 00:00:00 2001 From: Kumi Date: Tue, 23 Jul 2024 09:31:16 +0200 Subject: [PATCH] feat(issues): add comments for subprocess and file ops Added explanatory comments for steps using the Hugo CLI to generate new issues and subsequent file operations, improving code readability and maintainability. No functional changes were made. --- new_issue.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/new_issue.py b/new_issue.py index 41ccdcf..504d0aa 100755 --- a/new_issue.py +++ b/new_issue.py @@ -58,10 +58,12 @@ def create_issue( subprocess.CalledProcessError: If the Hugo command fails IOError: If any of the Python file operations fail """ + # Use the Hugo CLI to create a new issue subprocess.run( ["hugo", "new", f"weekly/issue-{issue_number}/_index.md"], check=True ) + # Read the content of the new file with open(f"content/weekly/issue-{issue_number}/_index.md", "r") as f: content = f.read() @@ -76,6 +78,7 @@ def create_issue( content = "\n".join(lines) + # Overwrite the file with the new content with open(f"content/weekly/issue-{issue_number}/_index.md", "w") as f: f.write(content)