From e7cf7d85afb20e6e8e591ea3dad31611b2779e0b Mon Sep 17 00:00:00 2001 From: SaintShit Date: Tue, 30 May 2023 17:37:50 +0330 Subject: [PATCH] fix: marzban-cli completion app's --shell option --- cli/utils.py | 8 ++++---- marzban-cli.py | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cli/utils.py b/cli/utils.py index 73b0bc21..0ff37d10 100644 --- a/cli/utils.py +++ b/cli/utils.py @@ -1,10 +1,10 @@ import pydoc -import typer from datetime import datetime -from typing import Any, Iterable, Optional, TypeVar, Union +from typing import Any, Dict, Iterable, Optional, TypeVar, Union -from rich.table import Table +import typer from rich.console import Console +from rich.table import Table from app.db import crud from app.db.models import User @@ -14,7 +14,7 @@ T = TypeVar("T") rich_console = Console() PASSWORD_ENVIRON_NAME = "MARZBAN_ADMIN_PASSWORD" -FLAGS: dict[str, tuple] = { +FLAGS: Dict[str, tuple] = { "username": ("--username", "-u"), "limit": ("--limit", "-l"), "offset": ("--offset", "-o"), diff --git a/marzban-cli.py b/marzban-cli.py index 16395de4..f177171f 100755 --- a/marzban-cli.py +++ b/marzban-cli.py @@ -33,18 +33,18 @@ def get_default_shell() -> Shells: @app_completion.command(help="Show completion for the specified shell, to copy or customize it.") -def show(ctx: typer.Context, shell: Shells = typer.Argument(None, - help="The shell to install completion for.", - case_sensitive=False)) -> None: +def show(ctx: typer.Context, shell: Shells = typer.Option(None, + help="The shell to install completion for.", + case_sensitive=False)) -> None: if shell is None: shell = get_default_shell() typer.completion.show_callback(ctx, None, shell) @app_completion.command(help="Install completion for the specified shell.") -def install(ctx: typer.Context, shell: Shells = typer.Argument(None, - help="The shell to install completion for.", - case_sensitive=False)) -> None: +def install(ctx: typer.Context, shell: Shells = typer.Option(None, + help="The shell to install completion for.", + case_sensitive=False)) -> None: if shell is None: shell = get_default_shell() typer.completion.install_callback(ctx, None, shell)