How to use the inquirer.Separator function in inquirer

To help you get started, we’ve selected a few inquirer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github open-wc / open-wc / packages / generator-open-wc / generators / app / index.js View on Github external
/* eslint-disable no-console */

const Generator = require('yeoman-generator');
const inquirer = require('inquirer');

const choices = {
  appStarter: 'Create Open Web Components Starter App',
  appProduction:
    'Create Open Web Components Enterprise App Setup (if you feel lost use the Starter App first)',
  separator1: new inquirer.Separator(),
  wcVanilla: 'Create a vanilla web component following the Open Web Components recommendations',
  wcUpgrade: 'Upgrade my existing web component to use the Open Web Components recommendations',
  separator2: new inquirer.Separator(),
  nothing: 'Nah, I am fine thanks! => exit',
};

module.exports = class GeneratorApp extends Generator {
  async prompting() {
    console.log('');
    console.log('Welcome to Open Web Components:');
    console.log('');

    this.answers = await this.prompt([
      {
        type: 'list',
        name: 'action',
github erkobridee / lab-nodejs / js_until_es5.1 / cli / inquirer-test / questions_flow.js View on Github external
function movies() {
  questions = [
    {
      type: 'list',
      name: 'selected',
      message: 'Movie',
      paginated : true,
      choices: [
        new inquirer.Separator('--- Action:'),
        '300: Rise of an Empire',
        'Non-Stop',
        'Robocop',
        'World War Z',
        new inquirer.Separator('--- Adventure:'),
        'Frozen',
        'The LEGO Movie',
        'The Legend of Hercules',
        'After Earth'
      ]
    }
  ];

  ask(questions, function( answer ) {
    selection.name = answer.selected;
    end();
  });

}
github Tram-One / tram-one / dev-scripts / example-selector.js View on Github external
const internalIp = require('internal-ip')

const question = {
  type: 'list',
  name: 'example',
  message: 'What example would you like to run?',
  choices: [
    new inquirer.Separator('-- Simple Examples --'),
    'using-actions',
    'using-routes',
    'using-nested-routes',
    'using-custom-elements',
    'using-everything',
    'using-listeners',
    'using-webEngine',
    new inquirer.Separator('-- Tiny Apps --'),
    'todo-pages',
    'todo-app',
    'image-carousel',
    'clock-example'
  ]
}

inquirer.prompt([question]).then((answer) => {
  console.log(`running ${answer.example}`)

  const webpackConfig = {
    entry: {
      app: [`./examples/${answer.example}/index.js`]
    },
    output: {
      path: path.resolve(__dirname, 'build'),
github ionic-team / ionic / core / scripts / deploy.js View on Github external
console.log(`\nPrepare to publish a new version of ${chalk.bold.magenta(pkg.name)} ${chalk.dim(`(${oldVersion})`)}\n`);

  const prompts = [
    {
      type: 'list',
      name: 'version',
      message: 'Select semver increment or specify new version',
      pageSize: SEMVER_INCREMENTS.length + 2,
      choices: SEMVER_INCREMENTS
        .map(inc => ({
          name: `${inc}   ${prettyVersionDiff(oldVersion, inc)}`,
          value: inc
        }))
        .concat([
          new inquirer.Separator(),
          {
            name: 'Other (specify)',
            value: null
          }
        ]),
      filter: input => isValidVersionInput(input) ? getNewVersion(oldVersion, input) : input
    },
    {
      type: 'input',
      name: 'version',
      message: 'Version',
      when: answers => !answers.version,
      filter: input => isValidVersionInput(input) ? getNewVersion(pkg.version, input) : input,
      validate: input => {
        if (!isValidVersionInput(input)) {
          return 'Please specify a valid semver, for example, `1.2.3`. See http://semver.org';
github dramamine / leftovers-again / scripts / roundrobin.js View on Github external
}).then(({ format }) => {
  const bots = findPossibleBots('lib/bots');
  const gtg = bots.filter(bot => isValid(bot, format));
  inquirer.prompt({
    name: 'chosen',
    message: 'How does this bot list look?',
    type: 'checkbox',
    choices: [
      new inquirer.Separator('==  ==  =='),
      ...gtg,
      new inquirer.Separator('  ==  ==')
    ],
    default: gtg
  }).then(({ chosen }) => {
    console.log('gr8');
  });
});
github alarner / perk / gulp / deploy / adapters / digitalocean.js View on Github external
serverPrompt: function(cb, results) {
			let imageChoices = results.images.map((image) => {
				return {name: (image.public ? '' : '*private* ')+image.distribution+' '+image.name, value: image.slug || image.id};
			});
			imageChoices.push(new inquirer.Separator());

			let dropletChoices = results.droplets.map((drop) => {
				return {name: drop.name, value: drop.id};
			});
			dropletChoices.unshift('new droplet');
			dropletChoices.push(new inquirer.Separator());

			inquirer.prompt(
				[
					{
						type: 'list',
						name: 'droplet',
						message: 'Where should we deploy this app?',
						choices:  dropletChoices
					},
					{
github NoDivide / astrum / manager / utils.js View on Github external
exclude_group = typeof exclude_group !== 'undefined' ? exclude_group : null;

        var choices = [];

        for (var i = 0; i < this.$data.groups.length; i++) {
            var g = this.$data.groups[i];

            if(exclude_group != g.name) {
                choices.push({
                    name: g.name,
                    value: g.name
                });
            }
        }

        choices.push(new inquirer.Separator());

        choices.push({
            name: 'Create a new group...',
            value: 'create_new_group'
        });

        return choices;
    },
github fastify / benchmarks / benchmark-bench.js View on Github external
function select (callback) {
  inquirer.prompt([
    {
      type: 'checkbox',
      message: 'Select packages',
      name: 'list',
      choices: [
        new inquirer.Separator(' = The usual ='),
        ...list(),
        new inquirer.Separator(' = The extras = '),
        ...list(true)
      ],
      validate: function (answer) {
        if (answer.length < 1) {
          return 'You must choose at least one package.'
        }
        return true
      }
    }
  ])
    .then(function (answers) {
      callback(answers.list)
    })
}
github govau / pancake / packages / pancake-syrup / src / prettiness.js View on Github external
module.exports.Headline = ( headline, subline = '', longestName ) => {
	let sideHeader = ( longestName - ( 4 * 2 ) - headline.length ) / 2; //calculate the sides for the headline for center alignment
	let sideSubline = ( longestName + 2 - subline.length ) / 2;         //calculate the sides for the subline for center alignment

	if( sideHeader < 0 ) { //getting edgy
		sideHeader = 0;
	}

	if( sideSubline < 0 ) { //getting edgy
		sideSubline = 0;
	}

	return [
		new Inquirer.Separator(` `),
		new Inquirer.Separator(
			`\u001b[0m\u001b[44m\u001b[1m\u001b[36m` +
			`  ═${ '═'.repeat( Math.ceil( sideHeader ) ) }${ headline }${ '═'.repeat( Math.floor( sideHeader ) ) }═  ` +
			`\u001b[39m\u001b[22m\u001b[49m\u001b[0m`
		),
		new Inquirer.Separator(
			`${ subline.length > 0 ? `${ ' '.repeat( Math.floor( sideSubline ) ) }\u001b[0m${ Style.cyan( subline ) }\u001b[0m` : `` }`
		),
	];
};
github algolia / create-instantsearch-app / src / cli / index.js View on Github external
(templates, [category, values]) => [
          ...templates,
          new inquirer.Separator(category),
          ...values,
        ],
        []