From df1cfdc3843d9a37602d3db3860698682679c95d Mon Sep 17 00:00:00 2001 From: Tom Date: Mon, 3 Feb 2025 11:27:50 +0000 Subject: [PATCH] Update new_post.py --- scripts/new_post.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/new_post.py b/scripts/new_post.py index 7f8e715..68b5287 100755 --- a/scripts/new_post.py +++ b/scripts/new_post.py @@ -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}") \ No newline at end of file +system(f"open {url}") + +print(f"Now on new branch post/{id_from_title}") +print("Make sure to edit, then commit and push changes.") \ No newline at end of file