From 28dc40ebf0cadabcd732bf150bac4aa2ea5ade43 Mon Sep 17 00:00:00 2001 From: Konstantin Fickel Date: Sun, 22 Jun 2025 15:19:09 +0200 Subject: [PATCH] feat: prettify streamer todo output Signed-off-by: Konstantin Fickel --- pyproject.toml | 1 + src/streamer/__init__.py | 19 +++++++++++++------ uv.lock | 2 ++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f4287de..f001bf9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,6 +9,7 @@ dependencies = [ "mistletoe>=1.4.0", "pydantic>=2.11.3", "pydantic-settings[yaml]>=2.10.0", + "rich>=14.0.0", "typer>=0.16.0", "xdg-base-dirs>=6.0.2", ] diff --git a/src/streamer/__init__.py b/src/streamer/__init__.py index 655322a..9c64032 100644 --- a/src/streamer/__init__.py +++ b/src/streamer/__init__.py @@ -2,6 +2,9 @@ import glob import os import typer import click +from rich import print +from rich.markdown import Markdown +from rich.panel import Panel from shutil import move from datetime import datetime @@ -24,13 +27,17 @@ def todo() -> None: for task_shard in open_tasks: print( - "\n".join( - file_content.splitlines()[ - task_shard.start_line - 1 : task_shard.end_line - ] + Panel( + Markdown( + "\n".join( + file_content.splitlines()[ + task_shard.start_line - 1 : task_shard.end_line + ] + ) + ), + title=f"{file_name}:{task_shard.start_line}", ) ) - print(f" {file_name}:{task_shard.start_line}") @app.command() @@ -57,7 +64,7 @@ def new() -> None: final_path = os.path.join(streamer_directory, final_file_name) move(prelimary_path, final_path) - click.echo(f"Saved as {click.style(final_file_name, fg='yellow')}") + print(f"Saved as [yellow]{final_file_name}") @app.callback(invoke_without_command=True) diff --git a/uv.lock b/uv.lock index 3dfa919..880297a 100644 --- a/uv.lock +++ b/uv.lock @@ -314,6 +314,7 @@ dependencies = [ { name = "mistletoe" }, { name = "pydantic" }, { name = "pydantic-settings", extra = ["yaml"] }, + { name = "rich" }, { name = "typer" }, { name = "xdg-base-dirs" }, ] @@ -332,6 +333,7 @@ requires-dist = [ { name = "mistletoe", specifier = ">=1.4.0" }, { name = "pydantic", specifier = ">=2.11.3" }, { name = "pydantic-settings", extras = ["yaml"], specifier = ">=2.10.0" }, + { name = "rich", specifier = ">=14.0.0" }, { name = "typer", specifier = ">=0.16.0" }, { name = "xdg-base-dirs", specifier = ">=6.0.2" }, ]