How to use the gluegun.prompt.ask function in gluegun

To help you get started, we’ve selected a few gluegun 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 SplitmediaLabsLimited / devctl / src / commands / init.js View on Github external
async function askEnv(database) {
  if (databases[database].env.length === 0) {
    return {};
  }

  const { env } = await prompt.ask({
    type: 'form',
    name: 'env',
    message: `Fill the configs for ${print.colors.warning(database)}`,
    choices: databases[database].env,
  });

  return env;
}
github SplitmediaLabsLimited / devctl / src / commands / switch.js View on Github external
if (keyA < keyB) return -1;
      if (keyA > keyB) return 1;
      return 0;
    });

  const choices = allChoices.filter(c => c.category !== 'always');
  const choicesArray = choices.map(c => c.value);
  const always = allChoices
    .filter(c => c.category === 'always')
    .map(c => c.value);

  const initial = get(project, 'current.services', []).filter(c =>
    choicesArray.includes(c)
  );

  const { services } = await prompt.ask({
    type: 'multiselect',
    name: 'services',
    message: 'Which services do you want to work on?',
    choices,
    initial,
  });

  return { services: [...services, ...always] };
}
github SplitmediaLabsLimited / devctl / src / commands / switch.js View on Github external
async function askEnvironment(project) {
  if (Object.values(project.environment).length === 1) {
    return {
      environment: Object.values(project.environment)[0].name,
    };
  }

  return await prompt.ask({
    type: 'select',
    name: 'environment',
    message: 'Which environment do you want to use?',
    choices: Object.values(project.environment).map(env => ({
      name: env.name,
      message: env.name,
      hint: env.description,
      value: env.name,
    })),
    initial: get(project, 'current.environment', null),
  });
}
github SplitmediaLabsLimited / devctl / src / commands / init.js View on Github external
async database => {
        const { version } = await prompt.ask([
          {
            type: 'select',
            name: 'version',
            message: `Choose a version for ${print.colors.warning(database)}`,
            choices: databases[database].versions,
          },
        ]);

        const env = await askEnv(database);

        const target = `.devctl/${database}/.devconfig.yaml`;

        const generate = {
          template: 'database.devconfig.yaml.ejs',
          target,
          props: {