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.
This commit is contained in:
parent
3968fd4248
commit
cf25a22641
1 changed files with 3 additions and 0 deletions
|
@ -58,10 +58,12 @@ def create_issue(
|
||||||
subprocess.CalledProcessError: If the Hugo command fails
|
subprocess.CalledProcessError: If the Hugo command fails
|
||||||
IOError: If any of the Python file operations fail
|
IOError: If any of the Python file operations fail
|
||||||
"""
|
"""
|
||||||
|
# Use the Hugo CLI to create a new issue
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["hugo", "new", f"weekly/issue-{issue_number}/_index.md"], check=True
|
["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:
|
with open(f"content/weekly/issue-{issue_number}/_index.md", "r") as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
|
|
||||||
|
@ -76,6 +78,7 @@ def create_issue(
|
||||||
|
|
||||||
content = "\n".join(lines)
|
content = "\n".join(lines)
|
||||||
|
|
||||||
|
# Overwrite the file with the new content
|
||||||
with open(f"content/weekly/issue-{issue_number}/_index.md", "w") as f:
|
with open(f"content/weekly/issue-{issue_number}/_index.md", "w") as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue