Show an interactive multi-select checkbox; return selected values or None if cancelled.
(prompt: str, items: Sequence[tuple[str, _T, bool]])
| 134 | |
| 135 | |
| 136 | def _checkbox(prompt: str, items: Sequence[tuple[str, _T, bool]]) -> list[_T] | None: |
| 137 | """Show an interactive multi-select checkbox; return selected values or None if cancelled.""" |
| 138 | # prompt_toolkit defaults "selected" to reverse-video (a filled block); override it |
| 139 | # so checked rows show a clean green ● and the cursor row is just bold. |
| 140 | style = questionary.Style( |
| 141 | [ |
| 142 | ("pointer", "bold"), |
| 143 | ("highlighted", "noreverse bold"), |
| 144 | ("selected", "noreverse fg:ansigreen"), |
| 145 | ] |
| 146 | ) |
| 147 | choices = [questionary.Choice(title=label, value=value, checked=checked) for label, value, checked in items] |
| 148 | instruction = "(↑↓ move · space select · a all · enter confirm)" |
| 149 | return questionary.checkbox(prompt, choices=choices, style=style, instruction=instruction).ask() |
| 150 | |
| 151 | |
| 152 | def _print_plan(agents: list[AgentTarget], integrations: list[_Integration]) -> None: |