Import std.term.prompts
Confirm
function
Public Function Confirm(question: String, default: Bool? = Null): Bool?
Asks question on the console, and gives True for yes or False for no, or default for ENTER
alone, when it has one.
function
Public Function Confirm(terminal: Terminal, question: String, default: Bool? = Null): Bool?
Asks question on terminal, and gives True for yes or False for no, or default for ENTER
alone, when it has one: a key, y or n in either case, where it's interactive, and a line
otherwise, "y", "yes", "n", or "no", in any case.
Examples
Local terminal = FakeTerminal(interactive: False)
terminal.Feed("yes\n")
Expect(Confirm(terminal, "Delete it?") == True)
terminal.Feed("Ada\n")
Expect(Ask(terminal, "Name?") == "Ada")Report an issue with this page or with FutureBlitz on GitHub.