From 315bdfb4a408377f7e22e73dd713223fdf5f212c Mon Sep 17 00:00:00 2001 From: derrod Date: Fri, 3 Sep 2021 20:10:30 +0200 Subject: [PATCH] [cli/core/lfs] Enable update check by default, make notice optional This will allow legendary to force checking for updates in critical situations where it may be required. Also enables updating configuration data on Linux by default. --- legendary/cli.py | 2 +- legendary/core.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/legendary/cli.py b/legendary/cli.py index fbf4731..258edce 100644 --- a/legendary/cli.py +++ b/legendary/cli.py @@ -1432,7 +1432,7 @@ def main(): logger.info('Command was aborted via KeyboardInterrupt, cleaning up...') # show note if update is available - if cli.core.update_available: + if cli.core.update_available and cli.core.update_notice_enabled(): if update_info := cli.core.get_update_info(): print(f'\nLegendary update available!') print(f'- New version: {update_info["version"]} - "{update_info["name"]}"') diff --git a/legendary/core.py b/legendary/core.py index ab2c7ec..9ed5d02 100644 --- a/legendary/core.py +++ b/legendary/core.py @@ -79,6 +79,7 @@ class LegendaryCore: self.log.warning(f'Could not determine locale, falling back to en-US') self.update_available = False + self.force_show_update = False def auth(self, username, password): """ @@ -201,8 +202,13 @@ class LegendaryCore: return True def update_check_enabled(self): - return self.lgd.config.getboolean('Legendary', 'enable_update_check', - fallback=os.name == 'nt') + return not self.lgd.config.getboolean('Legendary', 'disable_update_check', fallback=False) + + def update_notice_enabled(self): + if self.force_show_update: + return True + return not self.lgd.config.getboolean('Legendary', 'disable_update_notice', + fallback=os.name != 'nt') def check_for_updates(self, force=False): def version_tuple(v):