Skip to content

Commit 02e604d

Browse files
authored
✨ Show help on fastapi cloud with no args (#181)
1 parent 86ca4e7 commit 02e604d

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/fastapi_cloud_cli/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
cloud_app = typer.Typer(
2020
rich_markup_mode="rich",
2121
help="Manage [bold]FastAPI[/bold] Cloud deployments. 🚀",
22+
no_args_is_help=True,
2223
)
2324

2425
# TODO: use the app structure

tests/test_cli.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
import subprocess
22
import sys
33

4+
from typer.testing import CliRunner
5+
6+
from fastapi_cloud_cli.cli import app
7+
8+
runner = CliRunner()
9+
10+
11+
def test_shows_help() -> None:
12+
result = runner.invoke(app, ["cloud", "--help"])
13+
14+
assert result.exit_code == 0
15+
assert "Usage:" in result.output
16+
17+
18+
def test_shows_help_without_args() -> None:
19+
result = runner.invoke(app, ["cloud"])
20+
21+
assert result.exit_code == 2
22+
assert "Usage:" in result.output
23+
424

525
def test_script() -> None:
626
result = subprocess.run(

0 commit comments

Comments
 (0)