Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/user_interaction.py
diff options
context:
space:
mode:
Diffstat (limited to 'archinstall/lib/user_interaction.py')
-rw-r--r--archinstall/lib/user_interaction.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
new file mode 100644
index 00000000..bd6d117c
--- /dev/null
+++ b/archinstall/lib/user_interaction.py
@@ -0,0 +1,17 @@
+from .exceptions import *
+
+def select_disk(dict_o_disks):
+ drives = sorted(list(dict_o_disks.keys()))
+ if len(drives) > 1:
+ for index, drive in enumerate(drives):
+ print(f"{index}: {drive} ({dict_o_disks[drive]['size'], dict_o_disks[drive].device, dict_o_disks[drive]['label']})")
+ drive = input('Select one of the above disks (by number or full path): ')
+ if drive.isdigit():
+ drive = dict_o_disks[drives[int(drive)]]
+ elif drive in dict_o_disks:
+ drive = dict_o_disks[drive]
+ else:
+ raise DiskError(f'Selected drive does not exist: "{drive}"')
+ return drive
+
+ raise DiskError('select_disk() requires a non-empty dictionary of disks to select from.') \ No newline at end of file