2024-08-07 19:36:32 +01:00
|
|
|
package displaylist
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"git.eggactyl.cloud/Eggactyl/tui"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ListOptions struct {
|
|
|
|
Title string
|
|
|
|
Items []Item
|
|
|
|
}
|
|
|
|
|
|
|
|
type Item struct {
|
|
|
|
Key string
|
|
|
|
Value string
|
|
|
|
}
|
|
|
|
|
|
|
|
func New(opts ListOptions) {
|
|
|
|
|
2024-08-07 19:40:46 +01:00
|
|
|
fmt.Println(tui.FgColorGrey + "[ " + tui.Format(tui.FgColorGold, tui.FmtUnderline) + opts.Title + tui.Format(tui.FmtUnderlineReset, tui.FgColorGrey) + " ]" + tui.FmtReset)
|
2024-08-07 19:36:32 +01:00
|
|
|
|
|
|
|
for _, item := range opts.Items {
|
|
|
|
fmt.Println(itemString(item.Key, item.Value))
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func itemString(key string, value string) string {
|
|
|
|
return tui.FgColorGrey + "[ " + tui.FgColorGold + key + " " + tui.FgColorGrey + value + tui.FgColorGrey + " ]" + tui.FmtReset
|
|
|
|
}
|