Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function ejectCommand() {
const prompt = new MultiSelect({
// initial:[0, 1], // we could set default files to pick but choosing not to for now
name: 'files',
message:
'Pick files to copy out! **Note: use to pick files, <i> to invert selection**',
choices: [
{
name: '[ssgData].json.js',
value: 'src/routes/data/[ssgData].json.js',
hint: `ssg's default data route`,
enabled: true
},
{
name: 'sampleIndex.svelte',
value: 'src/routes/sampleIndex.svelte',
hint: `an example index page that pings ssg's default data route`
},</i>
'use strict';
const { MultiSelect } = require('enquirer');
const prompt = new MultiSelect({
name: 'example-groups',
message: 'What packages do you want to install?',
choices: [
{ name: 'dependencies', choices: ['ansi-colors', 'picomatch'] },
{ name: 'devDependencies', choices: ['kind-of', 'enquirer'] }
]
});
prompt
.run()
.then(answer => console.log('Answer:', answer))
.catch(console.error);
name: customization.name,
disabled: !force && !enabled ? '✔︎' : false,
message: force && !enabled ? chalk.red(customization.name) : customization.name,
});
}
if (!values.filter(({ disabled }) => !disabled).length) {
logReady();
console.log(
chalk.dim(`\u203A To regenerate the files run: ${chalk.bold('next-expo --force')}`)
);
console.log();
return;
}
const prompt = new MultiSelect({
hint: '(Use to select, to submit)\n',
message: `Which Next.js files would you like to generate?\n`,
limit: values.length,
choices: values,
});
let answer;
try {
answer = await prompt.run();
} catch (error) {
return;
}
await Promise.all(
answer
.map((item: any) => {
'use strict';
const { red, dim } = require('ansi-colors');
const { MultiSelect } = require('enquirer');
const prompt = new MultiSelect({
name: 'example-groups',
message: 'What are your favorite colors?',
symbols: { indicator: { on: red('❤'), off: dim.red('❤') } },
choices: ['Foo', 'Bar', 'Baz']
});
prompt.run()
.then(answer => console.log('Answer:', answer))
.catch(console.error);
'use strict';
const yosay = require('yosay');
const colors = require('ansi-colors');
const { MultiSelect } = require('enquirer');
/**
* Example that shows all of the prompt elements displayed at once.
*/
const prompt = new MultiSelect({
type: 'multiselect',
name: 'colors',
message: 'Pick your favorite colors',
hint: '(Use to select, to submit)',
limit: 6,
header: yosay('Welcome to my awesome generator!'),
format() {
return prompt.input + ' ' + prompt.styles.muted(prompt.state.hint);
},
pointer(state, choice, i) {
return (state.index === i ? state.symbols.pointer : ' ') + ' ';
},
footer(state) {
if (state.limit < state.choices.length) {
return colors.dim('(Scroll up and down to reveal more choices)');
}
'use strict';
const { MultiSelect } = require('enquirer');
const prompt = new MultiSelect({
name: 'value',
message: 'Pick your favorite colors',
hint: '(Use to select, to submit)',
choices: [
{ name: 'aqua', value: '#00ffff' },
{ name: 'black', value: '#000000' },
{ name: 'blue', value: '#0000ff', hint: '(this is a choice hint)' },
{ name: 'fuchsia', value: '#ff00ff' },
{ name: 'gray', value: '#808080' },
{ name: 'green', value: '#008000' },
{ name: 'lime', value: '#00ff00' },
{ name: 'maroon', value: '#800000' },
{ name: 'navy', value: '#000080' },
{ name: 'olive', value: '#808000' },
{ name: 'purple', value: '#800080' },
{ name: 'red', value: '#ff0000' },
'use strict';
const { MultiSelect } = require('enquirer');
let prompt = new MultiSelect({
type: 'multiselect',
name: 'value',
message: 'Pick colors',
hint: '(Use to select, to submit)',
initial: [1, 2, 3, 'teal'],
choices: [
{ name: 'aqua', value: '#00ffff', hint: 'Pick me!' },
{ name: 'black', value: '#000000' },
{ name: 'blue', value: '#0000ff' },
{ name: 'fuchsia', value: '#ff00ff' },
{ name: 'gray', value: '#808080' },
{ name: 'green', value: '#008000' },
{ name: 'lime', value: '#00ff00' },
{ name: 'maroon', value: '#800000', disabled: true },
{ name: 'navy', value: '#000080' },
{ name: 'olive', value: '#808000' },
'use strict';
const { MultiSelect } = require('enquirer');
const prompt = new MultiSelect({
type: 'multiselect',
name: 'value',
message: 'Pick colors',
hint: '(Use to select, to submit)',
limit: 5,
choices: [
{ name: 'aqua', value: '#00ffff', hint: 'Pick me!' },
{ name: 'black', value: '#000000' },
{ name: 'blue', value: '#0000ff' },
{ name: 'fuchsia', value: '#ff00ff' },
{ name: 'gray', value: '#808080' },
{ name: 'green', value: '#008000' },
{ name: 'lime', value: '#00ff00' },
{ name: 'maroon', value: '#800000' },
{ name: 'navy', value: '#000080' },
{ name: 'olive', value: '#808000' },
'use strict';
const { MultiSelect } = require('enquirer');
const prompt = new MultiSelect({
name: 'example-groups',
message: 'Take your pick',
choices: normalize({
local: ['one', 'two'],
global: ['three', 'four'],
other: [],
default: { message: 'Five' }
})
});
function normalize(obj) {
if (Array.isArray(obj)) {
return obj.map(ch => typeof ch === 'string' ? { name: ch } : ch);
}
let choices = [];
'use strict';
const { MultiSelect } = require('enquirer');
const prompt = new MultiSelect({
name: 'value',
message: 'Pick your favorite colors',
choices: [
{ name: 'aqua', value: '#00ffff' },
{ name: 'black', value: '#000000' },
{ name: 'blue', value: '#0000ff' },
{ name: 'fuchsia', value: '#ff00ff' },
{ name: 'gray', value: '#808080' },
{ name: 'green', value: '#008000' },
{ name: 'lime', value: '#00ff00' },
{ name: 'maroon', value: '#800000' },
{ name: 'navy', value: '#000080' },
{ name: 'olive', value: '#808000' },
{ name: 'purple', value: '#800080' },
{ name: 'red', value: '#ff0000' },
{ name: 'silver', value: '#c0c0c0' },