Create the selection panel with current selection highlighted.
()
| 172 | selected_key = None |
| 173 | |
| 174 | def create_selection_panel(): |
| 175 | """Create the selection panel with current selection highlighted.""" |
| 176 | table = Table.grid(padding=(0, 2)) |
| 177 | table.add_column(style="cyan", justify="left", width=3) |
| 178 | table.add_column(style="white", justify="left") |
| 179 | |
| 180 | for i, key in enumerate(option_keys): |
| 181 | if i == selected_index: |
| 182 | table.add_row("▶", f"[cyan]{key}[/cyan] [dim]({options[key]})[/dim]") |
| 183 | else: |
| 184 | table.add_row(" ", f"[cyan]{key}[/cyan] [dim]({options[key]})[/dim]") |
| 185 | |
| 186 | table.add_row("", "") |
| 187 | table.add_row("", "[dim]Use ↑/↓ to navigate, Enter to select, Esc to cancel[/dim]") |
| 188 | |
| 189 | return Panel( |
| 190 | table, |
| 191 | title=f"[bold]{prompt_text}[/bold]", |
| 192 | border_style="cyan", |
| 193 | padding=(1, 2) |
| 194 | ) |
| 195 | |
| 196 | console.print() |
| 197 |
no outgoing calls
no test coverage detected