[cli] Add --accept-path flag to automatically use computed save path

This commit is contained in:
derrod 2022-11-06 17:26:47 +01:00
parent da23690510
commit 2ed9557b2c

View file

@ -474,7 +474,7 @@ class LegendaryCLI:
# if there is no saved save path, try to get one # if there is no saved save path, try to get one
if not igame.save_path: if not igame.save_path:
if args.yes: if args.yes and not args.accept_path:
logger.info('Save path for this title has not been set, skipping due to --yes') logger.info('Save path for this title has not been set, skipping due to --yes')
continue continue
@ -486,6 +486,11 @@ class LegendaryCLI:
if '%' in save_path or '{' in save_path: if '%' in save_path or '{' in save_path:
logger.warning('Path contains unprocessed variables, please enter the correct path manually.') logger.warning('Path contains unprocessed variables, please enter the correct path manually.')
yn = False yn = False
# When accept_path is set we don't want to fall back to interactive mode
if args.accept_path:
continue
elif args.accept_path:
yn = True
else: else:
yn = get_boolean_choice('Is this correct?') yn = get_boolean_choice('Is this correct?')
@ -2805,6 +2810,8 @@ def main():
help='Override savegame path (requires single app name to be specified)') help='Override savegame path (requires single app name to be specified)')
sync_saves_parser.add_argument('--disable-filters', dest='disable_filters', action='store_true', sync_saves_parser.add_argument('--disable-filters', dest='disable_filters', action='store_true',
help='Disable save game file filtering') help='Disable save game file filtering')
sync_saves_parser.add_argument('--accept-path', dest='accept_path', action='store_true',
help=argparse.SUPPRESS)
clean_saves_parser.add_argument('--delete-incomplete', dest='delete_incomplete', action='store_true', clean_saves_parser.add_argument('--delete-incomplete', dest='delete_incomplete', action='store_true',
help='Delete incomplete save files') help='Delete incomplete save files')