From df8c447a231330ee2f08abf8b5a85aac0199e87c Mon Sep 17 00:00:00 2001 From: Joshua Herring Date: Mon, 11 May 2026 12:57:40 -0400 Subject: [PATCH] add descriptions to list --- main.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index 406eabe..aa37c62 100644 --- a/main.go +++ b/main.go @@ -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} }