JSPM

enquirer-prompt-editor

2.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q66183F
  • License MIT

Use your text editor as prompt input.

Package Exports

  • enquirer-prompt-editor

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (enquirer-prompt-editor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

enquirer-prompt-editor

Prompt for enquirer that opens your preferred text editor ($VISUAL or $EDITOR) and waits for you to save your input during a prompt.

Install

$ yarn add enquirer-prompt-editor

Usage

const Enquirer = require('enquirer');
const enquirer = new Enquirer();

enquirer.register('editor', require('enquirer-prompt-editor'));
enquirer
  .prompt({
    type: 'editor',
    name: 'bio',
    message: 'Please write a short bio of at least 3 lines.',
    extension: 'md',
    validate: text => {
      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));