mirror of
https://github.com/charmbracelet/gum
synced 2024-05-20 23:26:43 +02:00
fix(choose): error if selected options > limit
Rationale: If the number of selected options in `--selected` flag is greater than the limit, the last `n` options are selected where `n` is the limit.
This commit is contained in:
parent
1353b97272
commit
2c66222fd8
|
@ -46,6 +46,10 @@ func (o Options) Run() error {
|
|||
o.Limit = len(o.Options)
|
||||
}
|
||||
|
||||
if len(o.Selected) > o.Limit {
|
||||
return errors.New("number of selected options cannot be greater than the limit")
|
||||
}
|
||||
|
||||
// Keep track of the selected items.
|
||||
currentSelected := 0
|
||||
// Check if selected items should be used.
|
||||
|
|
Loading…
Reference in a new issue