Skip to content
FutureBlitz

    Install

    Import std.term.prompts

    Confirm

    std.term.prompts

    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.

    std/term/prompts.fb, line 31

    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")

    std/term/prompts.fb, line 48

    Report an issue with this page or with FutureBlitz on GitHub.