Editor prompt. Opens your text editor and waits for you to save your input during a prompt. Can be used standalone or with a prompt system like Enquirer.
Install with npm:
$ npm install --save prompt-editor
var Editor = require('prompt-editor');
var editor = new Editor({
type: 'editor',
name: 'background',
message: 'Please tell us about yourself in 3 lines or more.',
validate: function (text) {
if (text.split('\n').length < 3) {
return 'Must be at least 3 lines.';
}
return true;
}
});
editor.run()
.then(function(answers) {
console.log(answers)
});
var Enquirer = require('enquirer');
var enquirer = new Enquirer();
enquirer.register('editor', require('prompt-editor'));
var questions = [
{
type: 'editor',
name: 'bio',
message: 'Please write a short bio of at least 3 lines.',
validate: function (text) {
if (text.split('\n').length < 3) {
return 'Must be at least 3 lines.';
}
return true;
}
}
];
enquirer.ask(questions)
.then(function(answers) {
console.log(answers)
});
Related prompt modules:
- prompt-checkbox: Multiple-choice/checkbox prompt. Can be used standalone or with a prompt system like Enquirer. | homepage
- prompt-confirm: Confirm (yes/no) prompt. Can be used standalone or with a prompt system like Enquirer. | homepage
- prompt-expand: Expand prompt. Can be used as a standalone prompt, or with a prompt system like… more | homepage
- prompt-list: List-style prompt. Can be used as a standalone prompt, or with a prompt system like… more | homepage
- prompt-password: Password prompt. Can be used as a standalone prompt, or with a prompt system like… more | homepage
- prompt-radio: Radio prompt. This prompt behaves like other radio-button interfaces, where only one choice is enabled… more | homepage
- prompt-rawlist: Rawlist prompt. Can be used as a standalone prompt, or with a prompt system like… more | homepage
Based on the editor
prompt in inquirer.
- enquirer: Intuitive, plugin-based prompt system for node.js. Much faster and lighter alternative to Inquirer, with all… more | homepage
- prompt-choices: Create an array of multiple choice objects for use in prompts. | homepage
- prompt-question: Question object, used by Enquirer and prompt plugins. | homepage
- readline-utils: Readline utils, for moving the cursor, clearing lines, creating a readline interface, and more. | homepage
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Install dev dependencies:
$ npm install -d && npm test
Jon Schlinkert
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb-generate-readme, v0.1.31, on October 13, 2016.