def select_multiple(message: str, options: Sequence[str], hint="") -> List[int]: import survey try: styled_hint = _syle_hint(hint) styled_message = _style_message(message) kwargs = {"hint": styled_hint} if hint else {} indices = survey.select(options, styled_message, multi=True, pin="[✓] ", unpin="[ ] ", **kwargs) chosen = [options[index] for index in indices] response = ", ".join(chosen) if len(indices) == 0 or len(response) > 50: response = f"[{len(indices)} chosen]" survey.respond(response) return indices except (KeyboardInterrupt, SystemExit): survey.respond() raise
def select(message: str, options: Sequence[str], hint="") -> int: import survey try: styled_hint = _syle_hint(hint) styled_message = _style_message(message) index = survey.select(options, styled_message, hint=styled_hint) return index except (KeyboardInterrupt, SystemExit): survey.respond() raise