Fix get_options() and num_options to work on options

get_options() and num_options used to work on all menu items, including
blank spaces and headers. Now these work only on options, as they were
originally intended
This commit is contained in:
Sebastian Lohff 2020-03-11 18:18:26 +01:00
parent 9fe596bc01
commit 8c6ee790bf
1 changed files with 2 additions and 2 deletions

View File

@ -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: