Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/menu/menu.py
diff options
context:
space:
mode:
Diffstat (limited to 'archinstall/lib/menu/menu.py')
-rw-r--r--archinstall/lib/menu/menu.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/archinstall/lib/menu/menu.py b/archinstall/lib/menu/menu.py
index ac075b66..ee4b87e3 100644
--- a/archinstall/lib/menu/menu.py
+++ b/archinstall/lib/menu/menu.py
@@ -1,3 +1,5 @@
+from typing import Dict, List, Union, Any
+
from archinstall.lib.menu.simple_menu import TerminalMenu
from ..exceptions import RequirementError
from ..output import log
@@ -7,7 +9,17 @@ import sys
import logging
class Menu(TerminalMenu):
- def __init__(self, title, p_options, skip=True, multi=False, default_option=None, sort=True, preset_values=None, cursor_index=None):
+ def __init__(
+ self,
+ title :str,
+ p_options :Union[List[str], Dict[str, Any]],
+ skip :bool = True,
+ multi :bool = False,
+ default_option :str = None,
+ sort :bool = True,
+ preset_values :Union[str, List[str]] = None,
+ cursor_index :int = None
+ ):
"""
Creates a new menu
@@ -60,6 +72,11 @@ class Menu(TerminalMenu):
log(f"invalid parameter at Menu() call was at <{sys._getframe(1).f_code.co_name}>",level=logging.WARNING)
raise RequirementError('Menu.__init__() requires at least one option to proceed.')
+ if any([o for o in options if not isinstance(o, str)]):
+ log(" * Menu options must be of type string * ", fg='red')
+ log(f"invalid parameter at Menu() call was at <{sys._getframe(1).f_code.co_name}>",level=logging.WARNING)
+ raise RequirementError('Menu.__init__() requires the options to be of type string')
+
if sort:
options = sorted(options)