mirror of
https://github.com/oskvr37/tiddl.git
synced 2026-06-13 04:05:08 +03:00
✨ Added no browser opening option for authenticating command (#317)
* feat(auth): add no browser mode * chore: merge print statements
This commit is contained in:
@@ -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,6 +35,8 @@ def login():
|
||||
device_auth = auth_api.get_device_auth()
|
||||
|
||||
uri = f"https://{device_auth.verificationUriComplete}"
|
||||
|
||||
if not NO_BROWSER:
|
||||
typer.launch(uri)
|
||||
|
||||
console.print(f"Go to '{uri}' and complete authentication!")
|
||||
|
||||
Reference in New Issue
Block a user