mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
Merge branch 'dmitmel-master'
This commit is contained in:
commit
7bd91b677c
1 changed files with 7 additions and 2 deletions
|
@ -13,7 +13,11 @@ def platform_not_supported_error() -> NoReturn:
|
|||
raise Exception("platform '{}' is not supported!".format(sys.platform))
|
||||
|
||||
|
||||
def run_chooser(choices: Iterable[str], prompt: Optional[str] = None, async_read: bool = False) -> int:
|
||||
def run_chooser(
|
||||
choices: Iterable[str],
|
||||
prompt: Optional[str] = None,
|
||||
async_read: bool = False,
|
||||
) -> int:
|
||||
supports_result_index = True
|
||||
if os.isatty(sys.stderr.fileno()):
|
||||
process_args = [
|
||||
|
@ -41,7 +45,8 @@ def run_chooser(choices: Iterable[str], prompt: Optional[str] = None, async_read
|
|||
|
||||
with chooser_process.stdin as pipe:
|
||||
for index, choice in enumerate(choices):
|
||||
if "\n" not in choice:
|
||||
|
||||
if "\n" in choice:
|
||||
raise Exception("choices can only span a single line")
|
||||
if not supports_result_index:
|
||||
pipe.write(str(index).encode())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue