🚸 Add main menu
This commit is contained in:
parent
5b2896c032
commit
d8e671d5ca
4 changed files with 83 additions and 28 deletions
|
|
@ -35,7 +35,7 @@ func SimpleItem(title, text string, char rune) Option {
|
|||
return opt{title, text, char}
|
||||
}
|
||||
|
||||
func List(items []Option, cb func(*tview.List)) Option {
|
||||
func List(title string, items []Option, cb func(*tview.List)) Option {
|
||||
if len(items) == 0 {
|
||||
return opt{}
|
||||
}
|
||||
|
|
@ -47,7 +47,7 @@ func List(items []Option, cb func(*tview.List)) Option {
|
|||
for _, item := range items {
|
||||
list.AddItem(item.Title(), item.Text(), item.Rune(), item.Selected())
|
||||
}
|
||||
list.Box.SetBorder(true) //.SetTitle(title)
|
||||
list.Box.SetBorder(true).SetTitle(title)
|
||||
|
||||
if cb != nil {
|
||||
cb(list)
|
||||
|
|
@ -58,7 +58,7 @@ func List(items []Option, cb func(*tview.List)) Option {
|
|||
app.Stop()
|
||||
})
|
||||
|
||||
if err := app.SetRoot(list, false).EnableMouse(true).Run(); err != nil {
|
||||
if err := app.SetRoot(list, true).EnableMouse(true).Run(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue