diff --git a/README.md b/README.md index 81f367b..3537ed7 100644 --- a/README.md +++ b/README.md @@ -135,3 +135,21 @@ gulp.src('test.js') })); ``` + +Example List Selection: +[Note: see sample file]( examples/list-selection-gulpfile.js) +```javascript + + gulp.src( './package.json' ) + .pipe( prompt.prompt({ + type:'list', + name:'env', + message:'Please enter selection?', + choices: ['a','b','c','d','e','f', 'g', 'h'], + pageSize:'3' + }, (res) => { + console.log('Result', res); + }) ); + +``` + diff --git a/examples/list-selection-gulpfile.js b/examples/list-selection-gulpfile.js new file mode 100644 index 0000000..b5766a0 --- /dev/null +++ b/examples/list-selection-gulpfile.js @@ -0,0 +1,27 @@ +'use strict'; + +var gulp = require( 'gulp' ); +var prompt = require('../index'); + +/** + * The following is a sample gulp file for getting the list selection size from the command prompt + * Note: Gulp Prompt is a wrapper around inquirer.js so if it is available in inquirer.js + * it should be available within gulp-prompt. The prompt function is essentially a straight + * passthrough to the inquirer.js library. The page size variable is what sets the length of display + * items in list + * + * https://github.com/SBoudrias/Inquirer.js#questions + */ +gulp.task( 'getSelection', () => { + return gulp.src( './package.json' ) + .pipe( prompt.prompt({ + type:'list', + name:'env', + message:'Please enter selection?', + choices: ['a','b','c','d','e','f', 'g', 'h'], + pageSize:'3' + }, (res) => { + console.log('Result', res); + }) ); +}); + diff --git a/package.json b/package.json index 8d19a9b..bde3ba4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gulp-prompt", - "version": "0.3.1", + "version": "0.3.2", "description": "Add interactive console prompts to gulp", "main": "index.js", "scripts": {