fix: No output from arcade login when already logged in (#143)

I ran into this and was scratching my head why `arcade login` was
exiting with no output.

Fix: Get config data from the new top-level object we introduced.
This commit is contained in:
Nate Barbettini 2024-11-01 16:49:31 -07:00 committed by GitHub
parent aff7350eec
commit 1fdf982238
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 6 deletions

View file

@ -133,14 +133,12 @@ def check_existing_login() -> bool:
try:
with open(config_file_path) as f:
config: dict[str, Any] = yaml.safe_load(f)
api_key = config.get("api", {}).get("key")
email = config.get("user", {}).get("email")
cloud_config = config.get("cloud", {})
api_key = cloud_config.get("api", {}).get("key")
email = cloud_config.get("user", {}).get("email")
if api_key and email:
console.print(
f"You're already logged in as {email}. "
f"Delete {config_file_path} to log in as a different user."
)
console.print(f"You're already logged in as {email}. ", style="bold green")
return True
except yaml.YAMLError:
console.print(

View file

@ -64,6 +64,7 @@ def login(
"""
if check_existing_login():
console.print("Delete ~/.arcade/credentials.yaml to log in as a different user.\n")
return
# Start the HTTP server in a new thread