Skip to content

Commit d4ffbd9

Browse files
Merge pull request #291 from AndreWohnsland/dev
Do not run api main command on subcommands
2 parents 3de49c6 + 9145b7a commit d4ffbd9

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,3 @@ repos:
3131
name: ☕️ Ensure Shell Scripts are good with ShellCheck
3232
files: .*\.sh$
3333
args: [-x, -e, SC1017]
34-
- repo: https://github.com/pre-commit/mirrors-mypy
35-
rev: v1.15.0
36-
hooks:
37-
- id: mypy
38-
name: ☕️ Ensure types are correct with mypy
39-
args:
40-
- '--config-file=pyproject.toml'
41-
- '--python-version=3.11'
42-
additional_dependencies:
43-
- types-pyyaml>=6.0.12
44-
- types-requests>=2.32.0
45-
pass_filenames: false

src/programs/api_cli.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
@cli.callback(invoke_without_command=True)
1818
def api(
19+
ctx: typer.Context,
1920
port: int = typer.Option(8000, "--port", "-p", help="Port for the FastAPI server"),
2021
version: Optional[bool] = typer.Option(
2122
None, "--version", "-V", callback=version_callback, help="Show current version."
@@ -27,6 +28,8 @@ def api(
2728
The FastAPI server will be started at the given port.
2829
See also https://docs.cocktailberry.org/web/.
2930
"""
31+
if ctx.invoked_subcommand is not None:
32+
return
3033
run_api(port)
3134

3235

0 commit comments

Comments
 (0)