1.1.0 • Published 1 year ago

ask-readline v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

ask-readline

Ask a question for CLI using readline, supports muted input

npm i ask-readline

Usage

const ask = require('ask-readline')

main()

async function main () {
  const username = await ask('Input username (clear): ', { clear: true })
  const password = await ask('Input password (clear and muted): ', { clear: true, muted: true })
  const twoFactorAuth = await ask('Input 2fa (keep but muted): ', { clear: false, muted: true })
  const alias = await ask('Input alias (default): ')

  console.log({ username, password, twoFactorAuth, alias })
}

API

const answer = await ask(question, [options])

answer is a string or null.\ If user does CTRL+C then answer is null.

Available options:

{
  clear: false,
  muted: false
}

clear removes the line where the question was printed.\ muted ensures that input is hidden, and not written to stdout.

License

MIT

1.1.0

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago