From 6bc63bb369753b6ad140e8cc67c5ef6b5cfb84a6 Mon Sep 17 00:00:00 2001 From: hyperoot Date: Mon, 25 Nov 2024 11:49:23 +0000 Subject: [PATCH] fix: supports uvx --- omnishare/__main__.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/omnishare/__main__.py b/omnishare/__main__.py index 3abd364..893403a 100644 --- a/omnishare/__main__.py +++ b/omnishare/__main__.py @@ -16,10 +16,10 @@ @app.command() def main( - file: Annotated[str, typer.Argument(help="Provide markdown file")], - add_token: Annotated[bool | None, typer.Option(help="Add API token")] = False, - config: Annotated[bool | None, typer.Option(help="Configure the tool")] = False, - reset: Annotated[bool | None, typer.Option(help="Warning: Remove all saved tokens")] = False, + file: Annotated[str, typer.Argument(help="Provide markdown file")] = None, + add_token: Annotated[bool, typer.Option(help="Add API token")] = False, + config: Annotated[bool, typer.Option(help="Configure the tool")] = False, + reset: Annotated[bool, typer.Option(help="Warning: Remove all saved tokens")] = False, ): # Greeter console: Console = Console() @@ -49,9 +49,12 @@ def main( # TODO: Add handler pass - post: Post = process_file(file) - linkedin_post(markdown_to_plain(post.content)) - mastodon_post(markdown_to_plain(post.content)) + if file: + post: Post = process_file(file) + linkedin_post(markdown_to_plain(post.content)) + mastodon_post(markdown_to_plain(post.content)) + elif not (add_token or config or reset): + raise typer.BadParameter("No file provided") if __name__ == "__main__":