Method
_menu_lines
(
self,
prompt: str,
options: list[MenuOption],
selected_index: int,
)
Source from the content-addressed store, hash-verified
| 167 | self.stdout.flush() |
| 168 | |
| 169 | def _menu_lines( |
| 170 | self, |
| 171 | prompt: str, |
| 172 | options: list[MenuOption], |
| 173 | selected_index: int, |
| 174 | ) -> list[str]: |
| 175 | lines = [prompt, ""] |
| 176 | for index, option in enumerate(options): |
| 177 | prefix = "›" if index == selected_index else " " |
| 178 | label = option.label |
| 179 | if option.hint: |
| 180 | label = f"{label} — {option.hint}" |
| 181 | lines.append(f" {prefix} {label}") |
| 182 | lines.append("") |
| 183 | lines.append(" Use ↑/↓ to move, Enter to select.") |
| 184 | return lines |
| 185 | |
| 186 | def _read_key(self) -> str: |
| 187 | if os.name == "nt": |
Tested by
no test coverage detected