cview/demos/list/main.go

22 lines
547 B
Go
Raw Normal View History

2018-01-03 20:13:32 +00:00
// Demo code for the List primitive.
2017-12-27 15:05:00 +00:00
package main
import (
"git.sr.ht/~tslocum/cview"
2017-12-27 15:05:00 +00:00
)
func main() {
app := cview.NewApplication()
list := cview.NewList().
2017-12-27 15:05:00 +00:00
AddItem("List item 1", "Some explanatory text", 'a', nil).
AddItem("List item 2", "Some explanatory text", 'b', nil).
AddItem("List item 3", "Some explanatory text", 'c', nil).
AddItem("List item 4", "Some explanatory text", 'd', nil).
AddItem("Quit", "Press to exit", 'q', func() {
app.Stop()
})
2018-03-05 15:37:10 +00:00
if err := app.SetRoot(list, true).Run(); err != nil {
2017-12-27 15:05:00 +00:00
panic(err)
}
}