From d9d4766b2f28652169bb96932d795936d6efb99a Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Wed, 24 Jul 2024 15:14:35 -0400 Subject: [PATCH] Revert "Add key/value feature for `gum choose` (#530) (#598)" This reverts commit 9a3e11f5423ea0ea460fc8e99556a1bc9901893c. --- choose/command.go | 12 +----------- choose/options.go | 1 - 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/choose/command.go b/choose/command.go index 2c88e4c77..7d744857c 100644 --- a/choose/command.go +++ b/choose/command.go @@ -33,17 +33,7 @@ func (o Options) Run() error { } theme := huh.ThemeCharm() - options := make([]huh.Option[string], len(o.Options)) - for i, option := range o.Options { - parsed := strings.SplitN(option, o.Deliminator, 2) - if len(parsed) == 2 { - key := strings.TrimSpace(parsed[0]) - value := strings.TrimSpace(parsed[1]) - options[i] = huh.NewOption(key, value) - } else { - options[i] = huh.NewOption(option, option) - } - } + options := huh.NewOptions(o.Options...) theme.Focused.Base = lipgloss.NewStyle() theme.Focused.Title = o.HeaderStyle.ToLipgloss() diff --git a/choose/options.go b/choose/options.go index 0154b1c8f..c9f07bda4 100644 --- a/choose/options.go +++ b/choose/options.go @@ -26,5 +26,4 @@ type Options struct { ItemStyle style.Styles `embed:"" prefix:"item." hidden:"" envprefix:"GUM_CHOOSE_ITEM_"` SelectedItemStyle style.Styles `embed:"" prefix:"selected." set:"defaultForeground=212" envprefix:"GUM_CHOOSE_SELECTED_"` Timeout time.Duration `help:"Timeout until choose returns selected element" default:"0" env:"GUM_CCHOOSE_TIMEOUT"` // including timeout command options [Timeout,...] - Deliminator string `help:"Deliminator to split the options to keys and values" default:"=" env:"GUM_CHOOSE_DELIMINATOR"` }