Skip to content

Commit

Permalink
Add help command
Browse files Browse the repository at this point in the history
  • Loading branch information
mc-dorzo authored and kichanyurd committed Dec 24, 2024
1 parent 02a40cd commit 1fc30cb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/parlant/bin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# mypy: disable-error-code=import-untyped

import asyncio
import os
import click
import click.shell_completion
import click_completion # type: ignore
Expand Down Expand Up @@ -3028,6 +3029,19 @@ def tag_update(ctx: click.Context, id: str, name: str) -> None:
def tag_delete(ctx: click.Context, id: str) -> None:
Interface.delete_tag(ctx, id)

@cli.command("help", context_settings={"ignore_unknown_options": True})
@click.argument("command", nargs=-1, required=False)
@click.pass_context
def help_command(ctx: click.Context, command: Optional[tuple[str]] = None) -> None:
def transform_and_exec_help(command: str) -> None:
new_args = [sys.argv[0]] + command.split() + ["--help"]
os.execvp(sys.executable, [sys.executable] + new_args)

if not command:
click.echo(cli.get_help(ctx))
else:
transform_and_exec_help(" ".join(command))

cli()


Expand Down

0 comments on commit 1fc30cb

Please sign in to comment.