Compare commits

...

2 Commits

Author SHA1 Message Date
Sebastian Lohff 648d5c956e Use option text as title if no value is given
4 years ago
Sebastian Lohff 8c6ee790bf Fix get_options() and num_options to work on options
4 years ago

@ -99,10 +99,10 @@ class CliMenu:
if options:
for option in options:
if isinstance(option, tuple):
if isinstance(option, tuple) and len(option) == 2:
self.add_option(*option)
else:
self.add_option(option)
self.add_option(option, option)
def add_header(self, title, indent=True):
for text in title.split('\n'):
@ -120,11 +120,11 @@ class CliMenu:
return self._success
def get_options(self):
return self._items
return [_item for _item in self._items if isinstance(_item, CliMenuOption)]
@property
def num_options(self):
return len(self._items)
return self._item_num
def get_selection(self):
if self.success:

Loading…
Cancel
Save