fix: marzban-cli completion app's --shell option

This commit is contained in:
SaintShit
2023-05-30 17:37:50 +03:30
parent 6b62a4b144
commit e7cf7d85af
2 changed files with 10 additions and 10 deletions

View File

@@ -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"),

View File

@@ -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)