How to use the enquirer.Invisible function in enquirer

To help you get started, we’ve selected a few enquirer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github enquirer / enquirer / examples / invisible / option-separator.js View on Github external
'use strict';

const { dim, cyan, green } = require('ansi-colors');
const { Invisible } = require('enquirer');

const prompt = new Invisible({
  name: 'secret',
  message: 'What is your secret?',
  separator() {
    let bullet = this.symbols.bullet;
    if (this.state.submitted) return cyan(bullet);
    return this.typed ? green(bullet) : dim(bullet);
  }
});

prompt.run()
  .then(answer => console.log('Answer:', [answer]))
  .catch(console.error);
github enquirer / enquirer / examples / invisible / prompt.js View on Github external
'use strict';

const { Invisible } = require('enquirer');
const prompt = new Invisible({
  name: 'secret',
  message: 'What is your secret?'
});

prompt.run()
  .then(answer => console.log('Answer:', { secret: answer }))
  .catch(console.error);