refactor: fix lint and type check issues in CLI module

This commit is contained in:
Johan Lundberg 2026-02-18 11:34:00 +01:00
parent 4e83c3807e
commit e43720cd62
No known key found for this signature in database
GPG key ID: A6C152738D03C7D1

View file

@ -1,6 +1,6 @@
import asyncio
from pathlib import Path
from typing import Annotated, Optional
from typing import Annotated
import typer
@ -48,11 +48,11 @@ async def _initial_admin(settings: Settings, username: str, groups: list[str]) -
@app.command()
def create_invite(
username: str,
ttl: Annotated[Optional[int], typer.Option(help="Link expiration in seconds")] = None,
note: Annotated[Optional[str], typer.Option(help="Optional note stored with the link")] = None,
ttl: Annotated[int | None, typer.Option(help="Link expiration in seconds")] = None,
note: Annotated[str | None, typer.Option(help="Optional note stored with the link")] = None,
) -> None:
"""Generate a magic link registration URL for a new user."""
settings = Settings()
settings = Settings() # type: ignore[call-arg]
effective_ttl = ttl if ttl is not None else settings.invite_ttl
url = asyncio.run(_create_invite(settings, username, effective_ttl, note))
typer.echo(url)
@ -61,10 +61,10 @@ def create_invite(
@app.command()
def initial_admin(
username: str,
group: Annotated[Optional[list[str]], typer.Option(help="Groups to assign (repeatable)")] = None,
group: Annotated[list[str] | None, typer.Option(help="Groups to assign (repeatable)")] = None,
) -> None:
"""Bootstrap the first admin user with a registration link."""
settings = Settings()
settings = Settings() # type: ignore[call-arg]
groups = group if group is not None else ["admin", "users"]
url = asyncio.run(_initial_admin(settings, username, groups))
typer.echo(url)