Skip to content

Commit

Permalink
Typer does not support Union types.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielballan committed Jan 7, 2025
1 parent 9828c20 commit 75f8fc7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tiled/commandline/_api_key.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Optional, Union
from typing import List, Optional

import typer

@@ -12,7 +12,7 @@ def create_api_key(
profile: Optional[str] = typer.Option(
None, help="If you use more than one Tiled server, use this to specify which."
),
expires_in: Optional[Union[int, str]] = typer.Option(
expires_in: Optional[str] = typer.Option(
None,
help=(
"Number of seconds until API key expires, given as integer seconds "
@@ -36,6 +36,8 @@ def create_api_key(
# This is how typer interprets unspecified scopes.
# Replace with None to get default scopes.
scopes = None
if expires_in.isdigit():
expires_in = int(expires_in)
info = context.create_api_key(scopes=scopes, expires_in=expires_in, note=note)
# TODO Print other info to the stderr?
typer.echo(info["secret"])

0 comments on commit 75f8fc7

Please sign in to comment.