prompt-editor
v0.1.0
Published
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].
Downloads
10
Maintainers
Readme
prompt-editor
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
Install with npm:
$ npm install --save prompt-editor
Usage
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)
});
Enquirer usage
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)
});
Prompts
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
Attribution
Based on the editor
prompt in inquirer.
About
Related projects
- 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
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Running tests
Install dev dependencies:
$ npm install -d && npm test
Author
Jon Schlinkert
License
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb-generate-readme, v0.1.31, on October 13, 2016.