Use option text as title if no value is given

If the user only supplys a text for the option we used to return None as
item value. Now we return the text, so the user can easily get the value
back if they want to process it further and not only work with the given
option index (or supply the item twice).
This commit is contained in:
Sebastian Lohff 2020-03-11 18:19:19 +01:00
parent 8c6ee790bf
commit 648d5c956e
1 changed files with 2 additions and 2 deletions

View File

@ -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, option)
def add_header(self, title, indent=True):
for text in title.split('\n'):