File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,17 @@ func (o Options) Run() error {
33
33
}
34
34
35
35
theme := huh .ThemeCharm ()
36
- options := huh .NewOptions (o .Options ... )
36
+ options := make ([]huh.Option [string ], len (o .Options ))
37
+ for i , option := range o .Options {
38
+ parsed := strings .SplitN (option , o .Deliminator , 2 )
39
+ if len (parsed ) == 2 {
40
+ key := strings .TrimSpace (parsed [0 ])
41
+ value := strings .TrimSpace (parsed [1 ])
42
+ options [i ] = huh .NewOption (key , value )
43
+ } else {
44
+ options [i ] = huh .NewOption (option , option )
45
+ }
46
+ }
37
47
38
48
theme .Focused .Base = lipgloss .NewStyle ()
39
49
theme .Focused .Title = o .HeaderStyle .ToLipgloss ()
Original file line number Diff line number Diff line change @@ -26,4 +26,5 @@ type Options struct {
26
26
ItemStyle style.Styles `embed:"" prefix:"item." hidden:"" envprefix:"GUM_CHOOSE_ITEM_"`
27
27
SelectedItemStyle style.Styles `embed:"" prefix:"selected." set:"defaultForeground=212" envprefix:"GUM_CHOOSE_SELECTED_"`
28
28
Timeout time.Duration `help:"Timeout until choose returns selected element" default:"0" env:"GUM_CCHOOSE_TIMEOUT"` // including timeout command options [Timeout,...]
29
+ Deliminator string `help:"Deliminator to split the options to keys and values" default:"=" env:"GUM_CHOOSE_DELIMINATOR"`
29
30
}
You can’t perform that action at this time.
0 commit comments