[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.
This commit is contained in:
derrod 2021-09-03 20:10:30 +02:00
parent 0acfc47b33
commit 315bdfb4a4
2 changed files with 9 additions and 3 deletions

View file

@ -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"]}"')

View file

@ -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):