mirror of
https://github.com/charmbracelet/gum
synced 2024-06-15 20:15:08 +02:00
enter
This commit is contained in:
parent
78bb3b5f06
commit
c3588b695e
|
@ -136,7 +136,9 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
// Then we select the item that they have pressed enter on. If they
|
||||
// have selected items, then we simply return them.
|
||||
if m.numSelected < 1 {
|
||||
if o.AllowUnchoosen == false {
|
||||
m.items[m.index].selected = true
|
||||
}
|
||||
}
|
||||
return m, tea.Quit
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ type Options struct {
|
|||
|
||||
Limit int `help:"Maximum number of options to pick" default:"1" group:"Selection"`
|
||||
NoLimit bool `help:"Pick unlimited number of options (ignores limit)" group:"Selection"`
|
||||
AllowUnchoosen bool `help:"Allow gum choose to proceed when pressing enter without selecting anything" group:"Selection"`
|
||||
Ordered bool `help:"Maintain the order of the selected options" env:"GUM_CHOOSE_ORDERED"`
|
||||
Height int `help:"Height of the list" default:"10" env:"GUM_CHOOSE_HEIGHT"`
|
||||
Cursor string `help:"Prefix to show on item that corresponds to the cursor position" default:"> " env:"GUM_CHOOSE_CURSOR"`
|
||||
|
|
Loading…
Reference in a new issue