refactor: fix lint and type check issues in CLI module
This commit is contained in:
parent
4e83c3807e
commit
e43720cd62
1 changed files with 6 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Annotated, Optional
|
from typing import Annotated
|
||||||
|
|
||||||
import typer
|
import typer
|
||||||
|
|
||||||
|
|
@ -48,11 +48,11 @@ async def _initial_admin(settings: Settings, username: str, groups: list[str]) -
|
||||||
@app.command()
|
@app.command()
|
||||||
def create_invite(
|
def create_invite(
|
||||||
username: str,
|
username: str,
|
||||||
ttl: Annotated[Optional[int], typer.Option(help="Link expiration in seconds")] = None,
|
ttl: Annotated[int | None, typer.Option(help="Link expiration in seconds")] = None,
|
||||||
note: Annotated[Optional[str], typer.Option(help="Optional note stored with the link")] = None,
|
note: Annotated[str | None, typer.Option(help="Optional note stored with the link")] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Generate a magic link registration URL for a new user."""
|
"""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
|
effective_ttl = ttl if ttl is not None else settings.invite_ttl
|
||||||
url = asyncio.run(_create_invite(settings, username, effective_ttl, note))
|
url = asyncio.run(_create_invite(settings, username, effective_ttl, note))
|
||||||
typer.echo(url)
|
typer.echo(url)
|
||||||
|
|
@ -61,10 +61,10 @@ def create_invite(
|
||||||
@app.command()
|
@app.command()
|
||||||
def initial_admin(
|
def initial_admin(
|
||||||
username: str,
|
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:
|
) -> None:
|
||||||
"""Bootstrap the first admin user with a registration link."""
|
"""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"]
|
groups = group if group is not None else ["admin", "users"]
|
||||||
url = asyncio.run(_initial_admin(settings, username, groups))
|
url = asyncio.run(_initial_admin(settings, username, groups))
|
||||||
typer.echo(url)
|
typer.echo(url)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue