|
16 | 16 | import agentstack_cli.commands.self |
17 | 17 | import agentstack_cli.commands.server |
18 | 18 | import agentstack_cli.commands.user |
19 | | -from agentstack_cli.async_typer import AliasGroup, AsyncTyper |
| 19 | +from agentstack_cli.async_typer import AsyncTyper |
20 | 20 | from agentstack_cli.configuration import Configuration |
21 | 21 |
|
22 | 22 | logging.basicConfig(level=logging.INFO if Configuration().debug else logging.FATAL) |
23 | 23 | logging.getLogger("httpx").setLevel(logging.WARNING) # not sure why this is necessary |
24 | 24 |
|
25 | 25 |
|
26 | | -class RootHelpGroup(AliasGroup): |
27 | | - def get_help(self, ctx): |
28 | | - return """\ |
| 26 | +HELP_TEXT = """\ |
29 | 27 | Usage: agentstack [OPTIONS] COMMAND [ARGS]... |
30 | 28 |
|
31 | 29 | ╭─ Getting Started ──────────────────────────────────────────────────────────╮ |
@@ -63,7 +61,19 @@ def get_help(self, ctx): |
63 | 61 | """ |
64 | 62 |
|
65 | 63 |
|
66 | | -app = AsyncTyper(no_args_is_help=True, cls=RootHelpGroup) |
| 64 | +app = AsyncTyper() |
| 65 | + |
| 66 | + |
| 67 | +@app.callback(invoke_without_command=True) |
| 68 | +def main( |
| 69 | + ctx: typer.Context, |
| 70 | + help: bool = typer.Option(False, "--help", help="Show this message and exit."), |
| 71 | +): |
| 72 | + if help or ctx.invoked_subcommand is None: |
| 73 | + typer.echo(HELP_TEXT) |
| 74 | + raise typer.Exit() |
| 75 | + |
| 76 | + |
67 | 77 | app.add_typer(agentstack_cli.commands.model.app, name="model", no_args_is_help=True, help="Manage model providers.") |
68 | 78 | app.add_typer(agentstack_cli.commands.agent.app, name="agent", no_args_is_help=True, help="Manage agents.") |
69 | 79 | app.add_typer( |
|
0 commit comments