Use the CLI

Ask

Collect one line or many lines of text with tooee ask, and read what it prints.

tooee ask "Release note:"

The words after ask form the prompt. Ask opens an editor in insert mode. Enter adds a line and Shift+Enter submits. On submit, Ask prints the text followed by a newline and exits with code 0.

--single-line (-s) gives a one-line input where Enter submits:

tooee ask --single-line "Search for:"

--multiline (-m) is the default and can be passed for clarity.

To cancel, press Escape to reach cursor mode, then q. ctrl+c cancels from any mode. A cancelled Ask prints nothing and exits with code 1.

Keys

KeyModeAction
EscapeinsertSwitch to cursor mode
icursorInsert at the text cursor
acursorInsert after the text cursor
o, OcursorOpen a line below or above (multiline)
h, j, k, l, w, b, 0, $, g g, GcursorMove the text cursor
Enter, Shift+EntercursorSubmit
y y, y g, y vcursorCopy the line, the whole text, or the selection
pcursorPaste from the clipboard
:cursorOpen the command palette
qcursorCancel

Use the result in a script

Ask draws its screen on the controlling terminal and prints the submitted text on stdout. Command substitution captures the text alone:

name=$(tooee ask --single-line "Branch name:") || exit
git switch -c "$name"

Piped text on stdin is not used as an initial value. Ask reads keys from the terminal in that case. CLI reference lists the terminal channels and exit codes.

Call launch() from @tooee/ask when a script needs a default value, a placeholder, or its own commands. Ask from TypeScript covers that path.

Next

On this page