Browse Source

Check type of options passed to __init__

consistency-and-multiselect
Sebastian Lohff 2 years ago
parent
commit
9b833db364
  1. 9
      clintermission/climenu.py

9
clintermission/climenu.py

@ -111,10 +111,15 @@ class CliMenu: @@ -111,10 +111,15 @@ class CliMenu:
if options:
for option in options:
if isinstance(option, tuple) and len(option) == 2:
if isinstance(option, tuple):
self.add_option(*option)
else:
elif isinstance(option, dict):
self.add_option(**option)
elif isinstance(option, str):
self.add_option(option, option)
else:
raise ValueError("Option needs to be either tuple, dict or string, found '{}' of type {}"
.format(option, type(option)))
def add_header(self, *args, **kwargs):
return self.add_text(*args, **kwargs)

Loading…
Cancel
Save