This commit is contained in:
dingfeng.wong
2025-07-22 01:20:14 +08:00
parent 5f0d1d63de
commit 20adfed935
2 changed files with 10 additions and 9 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ dependencies = [
] ]
[project.scripts] [project.scripts]
ocr-screenshot = "tooling.cli:main" ocr-screenshot = "tooling.cli:cli_main"
[build-system] [build-system]
requires = ["hatchling"] requires = ["hatchling"]
+9 -8
View File
@@ -32,23 +32,19 @@ console = Console()
@app.command() @app.command()
def main( def main(
lang: str = typer.Option( lang: str = typer.Option(
"eng", default="eng",
"--lang",
help="Language code for OCR (default: eng)" help="Language code for OCR (default: eng)"
), ),
save_image: bool = typer.Option( save_image: bool = typer.Option(
False, default=False,
"--save-image",
help="Save the screenshot image instead of deleting it" help="Save the screenshot image instead of deleting it"
), ),
output_dir: Path = typer.Option( output_dir: Path = typer.Option(
Path.home() / "Desktop", default=Path.home() / "Desktop",
"--output-dir",
help="Directory to save screenshot if --save-image is used (default: ~/Desktop)" help="Directory to save screenshot if --save-image is used (default: ~/Desktop)"
), ),
verbose: bool = typer.Option( verbose: bool = typer.Option(
False, default=False,
"--verbose", "-v",
help="Show verbose output" help="Show verbose output"
) )
): ):
@@ -145,5 +141,10 @@ def main(
pass # Ignore cleanup errors pass # Ignore cleanup errors
def cli_main():
"""Entry point for the CLI script."""
app()
if __name__ == "__main__": if __name__ == "__main__":
app() app()