From 2db809712b06b8de8443a4ffcb0026ad7d7a6046 Mon Sep 17 00:00:00 2001 From: migueldingli1997 Date: Fri, 10 Jan 2020 19:51:26 +0100 Subject: [PATCH] Fixed prompt in repos setup and now actually clearing the config if the user chooses to do so. --- src/setup/setup_user_config_nodes.py | 8 ++++---- src/setup/setup_user_config_repos.py | 15 +++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/setup/setup_user_config_nodes.py b/src/setup/setup_user_config_nodes.py index 4afc65e..68f1368 100644 --- a/src/setup/setup_user_config_nodes.py +++ b/src/setup/setup_user_config_nodes.py @@ -54,14 +54,14 @@ def setup_nodes(cp: ConfigParser) -> None: 'new list of nodes, if you wish to do so (Y/n)\n'): return - # Ask if they want to set it up - if not yn_prompt('Do you wish to set up the list of nodes? (Y/n)\n'): - return - # Clear config and initialise new list cp.clear() nodes = [] + # Ask if they want to set it up + if not yn_prompt('Do you wish to set up the list of nodes? (Y/n)\n'): + return + # Get node details and append them to the list of nodes while True: node = get_node(nodes) diff --git a/src/setup/setup_user_config_repos.py b/src/setup/setup_user_config_repos.py index 378f548..08d24f8 100644 --- a/src/setup/setup_user_config_repos.py +++ b/src/setup/setup_user_config_repos.py @@ -45,21 +45,20 @@ def setup_repos(cp: ConfigParser) -> None: 'of GitHub repositories to monitor will now be set up.') # Check if list already set up - already_set_up = len(cp.sections()) > 0 - if already_set_up and \ + if len(cp.sections()) > 0 and \ not yn_prompt('The list of repositories is already set up. Do you ' - 'wish clear this list? You will then be asked to set ' - 'up a new list, if you wish to do so (Y/n)\n'): - return - - # Ask if they want to set it up - if not yn_prompt('Do you wish to set up the list of repos? (Y/n)\n'): + 'wish to clear this list? You will then be asked to ' + 'set up a new list, if you wish to do so (Y/n)\n'): return # Clear config and initialise new list cp.clear() repos = [] + # Ask if they want to set it up + if not yn_prompt('Do you wish to set up the list of repos? (Y/n)\n'): + return + # Get repository details and append them to the list of repositories while True: repo = get_repo()