1.2.1 • Published 5 years ago

inquirer-prompt-briefly v1.2.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

inquirer-prompt-briefly

version MIT License

Alternative for inquirer's editor prompt that supports file extensions.

Install

$ yarn add inquirer-prompt-briefly

Usage

const inquirer = require('inquirer');
inquirer.registerPrompt('briefly', require('inquirer-prompt-briefly'));

inquirer
  .prompt({
    type: 'briefly',
    name: 'bio',
    message: 'Please write a short bio of at least 3 lines.',
    extension: 'md',
    default: '# Well hello there!\n\n',
    validate: text => {
      if (typeof text !== 'string') {
        return true;
      }

      if (text.split('\n').length < 2) {
        return 'Must be at least 3 lines.';
      }
      return true;
    },
  })
  .then(answers => console.log(answers))
  .catch(err => console.log(err));