mirror of
https://github.com/charmbracelet/gum.git
synced 2024-09-11 06:16:03 +03: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 New Issue
Block a user