Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/netzo/deps/question/password.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.5.107/deps/question/password.ts";

Creates a free form text input that does not print the characters normally printed by the input prompt. The characters are substituted for a substitute string you can provide. If the substitute parameter is a boolean false no substitute characters will be printed.

The substitute string if longer than 1 character can be called a pattern and will also be printed in that pattern. So if you have a pattern of <> and that length of the text i 5 the substitution will look like <><><.

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
substitute: boolean | string

The substitution string or boolean indicating if you want a substitution string.

Returns

Promise<string | undefined>

The answer text or undefined if canceled.