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:
authorAnton Hvornum <anton.feeds+github@gmail.com>2020-07-06 18:44:42 +0200
committerAnton Hvornum <anton.feeds+github@gmail.com>2020-07-06 18:44:42 +0200
commitb4a6f03b962d9309a1a18bd6de6a50a0146252a1 (patch)
treebcdc2041ab9fe8733760fbe5d1d9f344923ceb0a /archinstall/lib/user_interaction.py
parentff9475ffe49d4ff8bca2b7fc1b6f8105e5277745 (diff)
Converted the lib to a pip supported structure to make packaging easier. Also tweaked some minor issues and added the AUR function
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