[cli] Ask for verification before installing/uninstalling

This commit is contained in:
derrod 2020-04-18 02:17:01 +02:00
parent 662f6e7bd0
commit 0b2917d1eb

View file

@ -288,7 +288,11 @@ def main():
for warn in sorted(res.warnings): for warn in sorted(res.warnings):
logger.warning(warn) logger.warning(warn)
_ = input('Do you wish to proceed? [Press Enter]') choice = input(f'Do you wish to install "{igame.title}"? [Y/n]: ')
if choice and choice.lower()[0] != 'y':
print('Aborting...')
exit(0)
start_t = time.time() start_t = time.time()
try: try:
@ -336,10 +340,16 @@ def main():
igame = core.get_installed_game(target_app) igame = core.get_installed_game(target_app)
if not igame: if not igame:
logger.error(f'Game {target_app} not installed, cannot uninstall!') logger.error(f'Game {target_app} not installed, cannot uninstall!')
exit(0)
if igame.is_dlc: if igame.is_dlc:
logger.error('Uninstalling DLC is not supported.') logger.error('Uninstalling DLC is not supported.')
exit(1) exit(1)
choice = input(f'Do you wish to uninstall "{igame.title}"? [y/N]: ')
if not choice or choice.lower()[0] != 'y':
print('Aborting...')
exit(0)
try: try:
logger.info(f'Removing "{igame.title}" from "{igame.install_path}"...') logger.info(f'Removing "{igame.title}" from "{igame.install_path}"...')
core.uninstall_game(igame) core.uninstall_game(igame)