From 0c14b063c9f2c3b1bb8a856da61dd0eb912fe290 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Sun, 19 Dec 2021 19:14:23 +0100 Subject: [PATCH] add y_n function --- scripts/format-disk.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/format-disk.py b/scripts/format-disk.py index 6b0399d..60156a6 100644 --- a/scripts/format-disk.py +++ b/scripts/format-disk.py @@ -17,6 +17,16 @@ def _get_system_memory(): return round(mem_gib) +def _y_n(question): + answer = input("{} (Y/N): ".format(question)) + if answer.lower() == "y": + return True + if answer.lower() == "n": + return False + print("Please only anwser with Y or N!") + sys.exit(1) + + def read_disks(): output = _run_command(["lsblk", "-dpno", "name"]) disks = []