From 20b95d087bada4d5cb72612b71c1acee6cbba773 Mon Sep 17 00:00:00 2001 From: James Turk Date: Sat, 4 Jan 2025 03:09:46 -0600 Subject: [PATCH] adjust cli --- pyproject.toml | 12 ++++++------ src/tt/cli.py | 14 ++++++++++---- src/tt/import_csv.py | 5 ----- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c52f7e3..9184dc5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,15 +5,15 @@ description = "Add your description here" readme = "README.md" requires-python = ">=3.10" dependencies = [ - "httpx>=0.28.1", - "lxml>=5.3.0", - "peewee>=3.17.8", - "textual>=1.0.0", - "typer>=0.15.1", + "httpx>=0.28.1", + "lxml>=5.3.0", + "peewee>=3.17.8", + "textual>=1.0.0", + "typer>=0.15.1", ] [project.scripts] -hello = "tt:hello" +tt = "tt.cli:app" [build-system] requires = ["hatchling"] diff --git a/src/tt/cli.py b/src/tt/cli.py index d8b7e09..f9790c1 100644 --- a/src/tt/cli.py +++ b/src/tt/cli.py @@ -1,10 +1,10 @@ -import uuid import typer import httpx import lxml.html -from datetime import datetime from typing_extensions import Annotated from .controller import add_task +from .import_csv import import_tasks_from_csv +from . import tui app = typer.Typer() @@ -39,8 +39,14 @@ def new( @app.command() -def search(q: str): - pass +def browse(): + tui.run() + + +@app.command() +def import_csv(filename: str): + import_tasks_from_csv(filename) + print("Import complete!") if __name__ == "__main__": diff --git a/src/tt/import_csv.py b/src/tt/import_csv.py index 93845e9..991acc9 100644 --- a/src/tt/import_csv.py +++ b/src/tt/import_csv.py @@ -45,8 +45,3 @@ def import_tasks_from_csv(filename: str): category_id=category_id, ) print(f"Imported task: {row['task']}") - - -if __name__ == "__main__": - import_tasks_from_csv(sys.argv[1]) - print("Import complete!")