Browse Source

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).
Sebastian Lohff 11 months ago
parent
commit
648d5c956e
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      clintermission/climenu.py

+ 2
- 2
clintermission/climenu.py View File

@@ -99,10 +99,10 @@ class CliMenu:
99 99
 
100 100
         if options:
101 101
             for option in options:
102
-                if isinstance(option, tuple):
102
+                if isinstance(option, tuple) and len(option) == 2:
103 103
                     self.add_option(*option)
104 104
                 else:
105
-                    self.add_option(option)
105
+                    self.add_option(option, option)
106 106
 
107 107
     def add_header(self, title, indent=True):
108 108
         for text in title.split('\n'):

Loading…
Cancel
Save