Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/netzo/deps/question/input.ts>default

Full-stack Deno framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
Go to Latest
function default
import { default } from "https://deno.land/x/netzo@0.4.62/deps/question/input.ts";

Create a generic text input question requesting the user to input text in a free form format. A default value can be provided and if the free form text input is blank that value will be used instead.

Controls:

  • Ctrl+c will have the question canceled and return undefined.
  • Ctrl+d will exit the whole script no questions asked with a Deno.exit().
  • Up arrow or Home key will move the cursor to the start of the prompt text.
  • Down arrow or End key will move the cursor to the end of the prompt text.
  • Left arrow will move the cursor one step to the left once if able.
  • Right arrow will move the cursor one step to the right once if able.
  • Enter will return the test inputted or the provided default value.

Requires --unstable until Deno version 1.27.

Parameters

label: string

The label the question will have.

optional
defaultValue: string | undefined

The value that will determine the resulting value if none was provided.

Returns

Promise<string | undefined>

The answer text, default value text, or undefined if canceled.