From 7a63ccbc5690b42a047f2227a122bfb8b316ea7a Mon Sep 17 00:00:00 2001 From: Rohail Taimour Date: Sat, 19 Oct 2024 09:27:56 +0200 Subject: [PATCH 1/2] add rework on help for website commands --- website/entrypoints.py | 49 ++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/website/entrypoints.py b/website/entrypoints.py index 870d7af..ef01445 100644 --- a/website/entrypoints.py +++ b/website/entrypoints.py @@ -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", ) From be8d67c08848f2d7fb19e51015b5632dbf652e87 Mon Sep 17 00:00:00 2001 From: Rohail Taimour Date: Sat, 19 Oct 2024 09:28:27 +0200 Subject: [PATCH 2/2] update gitignore to ignore build artefacts --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 18e89e1..26a8b58 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +dist/ assets/jsconfig.json # cache