From 985b7fac3ff400de9954d441480ab795222f4b24 Mon Sep 17 00:00:00 2001 From: SecondThundeR Date: Tue, 27 Apr 2021 15:14:28 +0300 Subject: Revert "Update logging for some functions" This reverts commit f5b6e7bafead1f604c27bfb31b84f3f560a682c8. Reverting commit due to currently redundant change and merge conflict --- archinstall/lib/user_interaction.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'archinstall/lib/user_interaction.py') diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index ec6b6d34..572acf4f 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -22,7 +22,11 @@ def get_longest_option(options): def check_for_correct_username(username): if re.match(r'^[a-z_][a-z0-9_-]*\$?$', username) and len(username) <= 32: return True - log(' * The username you entered is invalid. Try again * ', fg='red') + log( + "The username you entered is invalid. Try again", + level=LOG_LEVELS.Warning, + fg='red' + ) return False def do_countdown(): @@ -134,7 +138,8 @@ def ask_for_a_timezone(): return timezone else: log( - f"* Specified timezone {timezone} does not exist * ", + f"Specified timezone {timezone} does not exist.", + level=LOG_LEVELS.Warning, fg='red' ) @@ -180,7 +185,8 @@ def ask_to_configure_network(): break except ValueError: log( - 'You need to enter a valid IP in IP-config mode', + "You need to enter a valid IP in IP-config mode.", + level=LOG_LEVELS.Warning, fg='red' ) @@ -195,7 +201,8 @@ def ask_to_configure_network(): break except ValueError: log( - 'You need to enter a valid gateway (router) IP address', + "You need to enter a valid gateway (router) IP address.", + level=LOG_LEVELS.Warning, fg='red' ) @@ -251,15 +258,15 @@ def generic_select(options, input_text="Select one of the above by index or abso # Checking if options are different from `list` or `dict` if type(options) not in [list, dict]: log(f" * Generic select doesn't support ({type(options)}) as type of options * ", fg='red') - log('If problem persists, please create an issue on https://github.com/archlinux/archinstall/issues', fg='yellow') + log(" * If problem persists, please create an issue on https://github.com/archlinux/archinstall/issues * ", fg='yellow') raise RequirementError("generic_select() requires list or dictionary as options.") # To allow only `list` and `dict`, converting values of options here. # Therefore, now we can only provide the dictionary itself if type(options) == dict: options = list(options.values()) if sort: options = sorted(options) # As we pass only list and dict (converted to list), we can skip converting to list if len(options) == 0: - log(' * Generic select didn\'t find any options to choose from * ', fg='red') - log('If problem persists, please create an issue on https://github.com/archlinux/archinstall/issues', fg='yellow') + log(f" * Generic select didn't find any options to choose from * ", fg='red') + log(" * If problem persists, please create an issue on https://github.com/archlinux/archinstall/issues * ", fg='yellow') raise RequirementError('generic_select() requires at least one option to proceed.') @@ -391,7 +398,7 @@ def select_language(options, show_only_country_codes=True): new_options = list(search_keyboard_layout(filter_string)) if len(new_options) <= 0: - log(f"Search string '{filter_string}' yielded no results, please try another search", fg='yellow') + log(f"Search string '{filter_string}' yielded no results, please try another search.", fg='yellow') continue return select_language(new_options, show_only_country_codes=False) @@ -404,7 +411,7 @@ def select_language(options, show_only_country_codes=True): elif verify_keyboard_layout(selected_language): return selected_language else: - log(' * Given language was not found * ', fg='red') + log(" * Given language wasn't found * ", fg='red') raise RequirementError("Selecting languages require a least one language to be given as an option.") -- cgit v1.2.3-54-g00ecf