Added no browser opening option for authenticating command (#317)

* feat(auth): add no browser mode

* chore: merge print statements
This commit is contained in:
Magnetkopf
2026-04-06 15:42:51 +08:00
committed by GitHub
parent c3dd2d0606
commit d9e2314447
+11 -2
View File
@@ -17,7 +17,14 @@ auth_command = typer.Typer(
# TODO add context and load auth data from ctx
@auth_command.command(help="Login with your Tidal account.")
def login():
def login(
NO_BROWSER: Annotated[
bool,
typer.Option(
"--no-browser", "-n", help="Do not open browser."
),
] = False,
):
loaded_auth_data = load_auth_data()
if loaded_auth_data.token:
@@ -28,7 +35,9 @@ def login():
device_auth = auth_api.get_device_auth()
uri = f"https://{device_auth.verificationUriComplete}"
typer.launch(uri)
if not NO_BROWSER:
typer.launch(uri)
console.print(f"Go to '{uri}' and complete authentication!")