Skip to content

Commit

Permalink
Merge pull request #40 from shannonlal/v-0-3-2-List-Selection-Size
Browse files Browse the repository at this point in the history
V 0 3 2 list selection size
  • Loading branch information
shannonlal committed Sep 26, 2017
2 parents 0f46fab + 47572dc commit b474b83
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}) );

```

27 changes: 27 additions & 0 deletions examples/list-selection-gulpfile.js
Original file line number Diff line number Diff line change
@@ -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);
}) );
});

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit b474b83

Please sign in to comment.