add descriptions to list

master
Joshua Herring 1 month ago
parent 4538d3cec1
commit df8c447a23

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

Loading…
Cancel
Save