list-selection-gulpfile.js 916 B

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. var gulp = require( 'gulp' );
  3. var prompt = require('../index');
  4. /**
  5. * The following is a sample gulp file for getting the list selection size from the command prompt
  6. * Note: Gulp Prompt is a wrapper around inquirer.js so if it is available in inquirer.js
  7. * it should be available within gulp-prompt. The prompt function is essentially a straight
  8. * passthrough to the inquirer.js library. The page size variable is what sets the length of display
  9. * items in list
  10. *
  11. * https://github.com/SBoudrias/Inquirer.js#questions
  12. */
  13. gulp.task( 'getSelection', () => {
  14. return gulp.src( '../package.json' )
  15. .pipe( prompt.prompt({
  16. type:'list',
  17. name:'env',
  18. message:'Please enter selection?',
  19. choices: ['a','b','c','d','e','f', 'g', 'h'],
  20. pageSize:'3'
  21. }, (res) => {
  22. console.log('Result', res);
  23. }) );
  24. });