Rename add_header() to add_text()

add_header() does not necessarily add a header, it might be just text.
This commit is contained in:
Sebastian Lohff 2020-07-22 02:08:53 +02:00
parent a17f7693e9
commit 45d3395642
1 changed files with 5 additions and 2 deletions

View File

@ -95,7 +95,7 @@ class CliMenu:
self._style = self.default_style self._style = self.default_style
if header: if header:
self.add_header(header, indent=False) self.add_text(header, indent=False)
if options: if options:
for option in options: for option in options:
@ -104,7 +104,10 @@ class CliMenu:
else: else:
self.add_option(option, option) self.add_option(option, option)
def add_header(self, title, indent=True): def add_header(self, *args, **kwargs):
return self.add_text(*args, **kwargs)
def add_text(self, title, indent=True):
for text in title.split('\n'): for text in title.split('\n'):
self._items.append(CliMenuHeader(text, indent=indent)) self._items.append(CliMenuHeader(text, indent=indent))