mirror of
https://github.com/derrod/legendary.git
synced 2025-07-23 12:18:18 +00:00
[cli] Fix status command when not logged in yet
This commit is contained in:
parent
6b8838497b
commit
b7fd2031f9
|
@ -985,23 +985,34 @@ class LegendaryCLI:
|
||||||
|
|
||||||
def status(self, args):
|
def status(self, args):
|
||||||
if not args.offline:
|
if not args.offline:
|
||||||
if not self.core.login():
|
try:
|
||||||
logger.error('Log in failed!')
|
if not self.core.login():
|
||||||
exit(1)
|
logger.error('Log in failed!')
|
||||||
|
exit(1)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if not self.core.lgd.userdata:
|
||||||
|
user_name = '<not logged in>'
|
||||||
|
args.offline = True
|
||||||
|
else:
|
||||||
|
user_name = self.core.lgd.userdata['displayName']
|
||||||
|
|
||||||
|
games_available = len(self.core.get_game_list(update_assets=not args.offline))
|
||||||
|
games_installed = len(self.core.get_installed_list())
|
||||||
if args.json:
|
if args.json:
|
||||||
print(json.dumps(dict(
|
print(json.dumps(dict(
|
||||||
account=self.core.lgd.userdata["displayName"],
|
account=user_name,
|
||||||
games_available=len(self.core.get_game_list(update_assets=not args.offline)),
|
games_available=games_available,
|
||||||
games_installed=len(self.core.get_installed_list()),
|
games_installed=games_installed,
|
||||||
egl_sync_enabled=self.core.egl_sync_enabled,
|
egl_sync_enabled=self.core.egl_sync_enabled,
|
||||||
config_directory=self.core.lgd.path
|
config_directory=self.core.lgd.path
|
||||||
), indent=2, sort_keys=True))
|
), indent=2, sort_keys=True))
|
||||||
return
|
return
|
||||||
|
|
||||||
print(f'Epic account: {self.core.lgd.userdata["displayName"]}')
|
print(f'Epic account: {user_name}')
|
||||||
print(f'Games available: {len(self.core.get_game_list(update_assets=not args.offline))}')
|
print(f'Games available: {games_available}')
|
||||||
print(f'Games installed: {len(self.core.get_installed_list())}')
|
print(f'Games installed: {games_installed}')
|
||||||
print(f'EGL Sync enabled: {self.core.egl_sync_enabled}')
|
print(f'EGL Sync enabled: {self.core.egl_sync_enabled}')
|
||||||
print(f'Config directory: {self.core.lgd.path}')
|
print(f'Config directory: {self.core.lgd.path}')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue