add descriptions to list

master
Joshua Herring 1 month ago
parent 4538d3cec1
commit df8c447a23

@ -17,11 +17,15 @@ const (
stateForm stateForm
) )
type item string type CommandItem struct {
ItemTitle string `json:"title"`
ItemDescription string `json:"description"`
}
func (i item) FilterValue() string { return string(i) } func (i CommandItem) FilterValue() string { return i.ItemTitle }
func (i item) Title() string { return string(i) } func (i CommandItem) Title() string { return i.ItemTitle }
func (i item) Description() string { return "" } func (i CommandItem) Description() string { return i.ItemDescription }
func (i CommandItem) String() string { return i.ItemTitle }
type model struct { type model struct {
list list.Model list list.Model
@ -57,11 +61,11 @@ func (m *model) ReadForm() {
func newModel() model { func newModel() model {
items := []list.Item{ items := []list.Item{
item("Run Command"), CommandItem{ItemTitle: "Run Command", ItemDescription: "Run a command on the remote host",},
item("Upload File"), CommandItem{ItemTitle: "Upload File", ItemDescription: "Upload a file to the remote host",},
} }
l := list.New(items, list.NewDefaultDelegate(), 80, 20) l := list.New(items, list.NewDefaultDelegate(), 80, 20)
l.Title = "prddeploy" l.Title = "Commands"
return model{list: l, state: stateList} return model{list: l, state: stateList}
} }

Loading…
Cancel
Save