From 648d5c956e1f5cd78394fb23a6116bae7e5b9cd6 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Wed, 11 Mar 2020 18:19:19 +0100 Subject: [PATCH] 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). --- clintermission/climenu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clintermission/climenu.py b/clintermission/climenu.py index 4f8170b..cef166e 100644 --- a/clintermission/climenu.py +++ b/clintermission/climenu.py @@ -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'):