index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Anton Hvornum <anton.feeds+github@gmail.com> | 2020-09-01 13:43:19 +0200 |
---|---|---|
committer | Anton Hvornum <anton.feeds+github@gmail.com> | 2020-09-01 13:43:19 +0200 |
commit | 52a08a492f28a09a237ed0367c8cc03b53d72112 (patch) | |
tree | 27edbcc784ff956d78976dade0c44d32731128e9 /archinstall | |
parent | 5bba102c45a9709891c5ad7ed20a42b1f036d9a2 (diff) |
-rw-r--r-- | archinstall/lib/user_interaction.py | 38 |
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py index f9e7bf18..8b093f13 100644 --- a/archinstall/lib/user_interaction.py +++ b/archinstall/lib/user_interaction.py @@ -38,7 +38,7 @@ def select_language(options, show_only_country_codes=True): # I'm leaving "options" on purpose here. # Since languages possibly contains a filtered version of # all possible language layouts, and we might want to write - # for instance sv-latin1 (if we know that exists) without havnig to + # for instance sv-latin1 (if we know that exists) without having to # go through the search step. elif selected_language in options: selected_language = options[options.index(selected_language)] @@ -46,4 +46,40 @@ def select_language(options, show_only_country_codes=True): RequirementError("Selected language does not exist.") return selected_language + raise RequirementError("Selecting languages require a least one language to be given as an option.") + +def select_mirror_regions(mirrors, show_top_mirrors=True): + # TODO: Support multiple options and country ycodes, SE,UK for instance. + regions = sorted(list(regions.keys())) + selected_mirrors = {} + + if len(regions) >= 1: + for index, region in enumerate(regionss): + print(f"{index}: {region}") + + print(' -- You can enter ? or help to search for more regions --') + selected_mirror = input('Select one of the above regions to download packages from (by number or full name): ') + if selected_mirror.lower() in ('?', 'help'): + filter_string = input('Search for a region containing (example: "united"): ').strip().lower() + for region in mirrors: + if filter_string in region.lower(): + selected_mirrors[region] = mirrors[region] + + return selected_mirrors + + elif selected_mirror.isdigit() and (pos := int(selected_mirror)) <= len(languages)-1: + region = sorted(list(mirrors.keys()))[int(selected_mirror)] + selected_mirrors[region] = mirrors[region] + # I'm leaving "mirrors" on purpose here. + # Since region possibly contains a known region of + # all possible regions, and we might want to write + # for instance Sweden (if we know that exists) without having to + # go through the search step. + elif selected_mirror in mirrors: + selected_mirrors[selected_mirror] = mirrors[mirrors.index(selected_mirror)] + else: + RequirementError("Selected language does not exist.") + + return selected_mirrors + raise RequirementError("Selecting languages require a least one language to be given as an option.")
\ No newline at end of file |