Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
assets/jsconfig.json

dist/
Expand Down
49 changes: 23 additions & 26 deletions website/entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,38 @@
from website.posts import concatenate_drafts, create_new_post
from website.task_helpers import check_project_root

app = typer.Typer(add_completion=False)


@app.command()
def new_post(title: str, series=None, quarto=False):
"""
Create a new post with a given title under a specified category.
Optionally, specify a series name.
Params:
"title": "The title of the blog post you want to create."
"series": "The series to which the blog post belongs (optional)."
"quarto": "Initialize a quarto_document, defaults to False"
"""
app = typer.Typer(
add_completion=False, help="Utility helpers for working on my website."
)


@app.command(help="Create a new (series) post with a given title.")
def new_post(
title: str = typer.Option(help="The title of the blog."),
series: str
| None = typer.Option(
help="The series the blog post entry belongs to.", default=None
),
quarto: bool = typer.Option(
help="Initialize a quarto_document instead of regular markdown", default=False
),
):
check_project_root()
create_new_post(title, series, quarto)


@app.command()
@app.command(help="Concatenate all draft posts into a single markdown file.")
def list_draft_posts(
file_out="current_draft_posts.md",
search_directory="content/post",
search_string="draft: true",
file_out: str = typer.Option(
help="The output file name for concatenated drafts.",
default="current_draft_posts.md",
),
):
"""
Concatenate all draft posts into a single markdown file.
Params
"file_out": "The output file name for concatenated drafts. Defaults to 'concatenated_drafts.md'."
"search_directory": "The directory to search for draft posts. Defaults to 'content/post'."
"search_string": "The string to search for in the markdown files to identify drafts. Defaults to 'draft: true'."
"""
check_project_root()
concatenate_drafts(
file_out=file_out,
search_directory=search_directory,
search_string=search_string,
search_directory="content/post",
search_string="draft: true",
)


Expand Down