Expand description
§Prompt input
Reads the answer to an interactive prompt (the setup wizard, a token selection) from stdin, so that a cancel can stop the read.
In the TUI, a suspend-mode command reads its prompts on the plain
terminal. Ctrl-C there must cancel the command and return to the TUI. A
blocking read_line cannot be stopped, and a read on another thread
would stay behind and take the TUI’s next keys. So the reader waits for
input in short steps and checks CANCEL between them. It reads one
byte at a time, so it never takes bytes after the newline.
Outside the TUI nothing sets CANCEL, and the reader acts as
read_line does.
Every prompt goes through ask (or pick, for a numbered list).
It pauses the progress bars, so a spinner never draws over a question.
A question, a list to pick from and the text around a prompt are not
data: they go to the diagnostic channel of the Output. So piped
data stays clean, and a TUI run keeps only data for Ctrl-Y and save.
Functions§
- ask_
stdin askon stdin (cancellable in the TUI). Thescopebinary’s own prompts use it.