index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Ninchester <5041877+ninchester@users.noreply.github.com> | 2021-03-20 21:41:56 +0100 |
---|---|---|
committer | Ninchester <5041877+ninchester@users.noreply.github.com> | 2021-03-20 21:41:56 +0100 |
commit | 9f87b6963d6b195c35891366cbd5421324a593e3 (patch) | |
tree | 90e2aee91121aae1e6de03f7b45b2c5dd139ffcc /archinstall/lib | |
parent | e209767d13bb8887ad7449cab59501fdc0eb4f77 (diff) |
-rw-r--r-- | archinstall/lib/user_interaction.py | 18 |
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index b9689d05..b3baebf8 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -27,6 +27,21 @@ def get_password(prompt="Enter a password: "): return passwd return None +def print_large_list(options, padding=5, margin_bottom=0, separator=': '): + longest_line = len(str(len(options))) + len(separator) + get_longest_option(options) + padding + num_of_columns = get_terminal_width() // longest_line + max_options_in_cells = num_of_columns * (get_terminal_height()-margin_bottom) + + if (len(options) > max_options_in_cells): + for index, option in enumerate(options): + print(f"{index}: {option}") + else: + for row in range(0, (get_terminal_height()-margin_bottom)): + for column in range(row, len(options), (get_terminal_height()-margin_bottom)): + spaces = " "*(longest_line - len(options[column])) + print(f"{str(column+1).zfill(2)}{separator}{options[column]}", end = spaces) + print() + def ask_for_superuser_account(prompt='Create a required super-user with sudo privileges: ', forced=False): while 1: new_user = input(prompt).strip(' ') @@ -279,8 +294,7 @@ def select_mirror_regions(mirrors, show_top_mirrors=True): selected_mirrors = {} if len(regions) >= 1: - for index, region in enumerate(regions): - print(f"{index}: {region}") + print_large_list(regions) print(' -- You can enter ? or help to search for more regions --') print(' -- You can skip this step by leaving the option blank --') |