[cli] Add "--keep-files" to uninstall without deleting

This commit is contained in:
derrod 2020-11-02 15:55:36 +01:00
parent 477827033e
commit 80841f89bb

View file

@ -748,10 +748,10 @@ class LegendaryCLI:
for dlc in dlcs:
if (idlc := self.core.get_installed_game(dlc.app_name)) is not None:
logger.info(f'Uninstalling DLC "{dlc.app_name}"...')
self.core.uninstall_game(idlc)
self.core.uninstall_game(idlc, delete_files=not args.keep_files)
logger.info(f'Removing "{igame.title}" from "{igame.install_path}"...')
self.core.uninstall_game(igame, delete_root_directory=True)
self.core.uninstall_game(igame, delete_files=not args.keep_files, delete_root_directory=True)
logger.info('Game has been uninstalled.')
except Exception as e:
logger.warning(f'Removing game failed: {e!r}, please remove {igame.install_path} manually.')
@ -1146,6 +1146,9 @@ def main():
install_parser.add_argument('--disable-delta-manifests', dest='disable_delta', action='store_true',
help='Do not use delta manfiests when updating (may increase download size)')
uninstall_parser.add_argument('--keep-files', dest='keep_files', action='store_true',
help='Keep files but remove game from Legendary database')
launch_parser.add_argument('--offline', dest='offline', action='store_true',
default=False, help='Skip login and launch game without online authentication')
launch_parser.add_argument('--skip-version-check', dest='skip_version_check', action='store_true',