Skip to content

Commit

Permalink
disabled options cannot be selected or returned
Browse files Browse the repository at this point in the history
  • Loading branch information
iamalisalehi committed Jul 17, 2024
1 parent 256e5dc commit c422252
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pick/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,15 @@ def __post_init__(self) -> None:
"min_selection_count is bigger than the available options, you will not be able to make any selection"
)

if all(isinstance(option, Option) and option.enabled == False for option in self.options):
raise NotImplementedError(
"all given options are disabled, you must at least have one enabled option."
)

self.index = self.default_index
option = self.options[self.index]
if isinstance(option, Option) and not option.enabled:
self.move_down()

def move_up(self) -> None:
while True:
Expand Down

0 comments on commit c422252

Please sign in to comment.