mirror of
https://github.com/TomHodson/tomhodson.github.com.git
synced 2025-06-26 10:01:18 +02:00
Update new_post.py
This commit is contained in:
parent
cd80ff3ab8
commit
df1cfdc384
@ -63,12 +63,18 @@ image_class: invertable
|
||||
---
|
||||
|
||||
"""
|
||||
print(f"Will create new branch post/{id_from_title} based off main.")
|
||||
print("Post header yaml will be:")
|
||||
print(draft)
|
||||
if not questionary.confirm("Create post?").ask():
|
||||
sys.exit()
|
||||
|
||||
repo.git.checkout("main")
|
||||
repo.git.checkout("-b", f"post/{id_from_title}")
|
||||
|
||||
with open(f"_posts/{filename}", "w") as f:
|
||||
f.write(draft)
|
||||
|
||||
print(f"Made new post at _posts/{filename}")
|
||||
|
||||
if questionary.confirm(f"Create {assets_dir}").ask():
|
||||
@ -78,4 +84,7 @@ Path("highlights.md").touch()
|
||||
Path("blog.md").touch()
|
||||
|
||||
url = f"http://localhost:4100/{now.strftime('%Y/%m/%d/')}{id_from_title}.html"
|
||||
system(f"open {url}")
|
||||
system(f"open {url}")
|
||||
|
||||
print(f"Now on new branch post/{id_from_title}")
|
||||
print("Make sure to edit, then commit and push changes.")
|
Loading…
x
Reference in New Issue
Block a user