Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async listOrgs(orgs: Org[]) {
const { index } = await prompt({
type: "autocomplete",
name: "index",
// @ts-ignore
limit: 20,
message:
`${colors.bold(orgs.length.toString())} orgs found\n\n` +
[
col("Name", 20),
col("Owner", 30),
col("Members", 10),
col("Groups", 10),
col("Vaults", 10),
col("Plan", 15),
col("Status", 20)
]
.map(c => colors.bold.underline(c))
type: 'input',
name: 'expDate',
message: 'Expiration Date',
hint: 'mm/yyyy',
validate: (value) => {
const parts = value.replace(/\s/g, '').split('/')
return !ccValidator.isExpired(...parts)
},
result: (value) => {
return value.replace(/\s/g, '').split('/')
}
}
]
console.log('Please enter your credit card details:')
const card = await prompt(prompts)
let token
try {
const result = await spinner(
createBillingSource(card),
'Creating secure billing token'
)
token = result.id
} catch (err) {
console.error('Error initializing payment source', err.message)
process.exit(1)
}
const source = await spinner(
client.addBillingSource({ source: token }),
'Attaching billing source to user'
async function selectDependencies(updateDependencies) {
let response;
try {
response = await prompt({
type: 'multiselect',
name: 'dependencies',
message: 'Select dependencies for update',
choices: Object.keys(updateDependencies).map((key) => ({
message: getUpdateValue(
key,
updateDependencies[key].versions[0],
updateDependencies[key].latestVersion
),
value: key,
})),
initial: Array.apply(null, new Array(Object.keys(updateDependencies).length)).map((_x, index) => index),
});
} catch (err) {
process.exit(1);
return;
function addEnv() {
cli_helper_1.printSubheader('Add New Environment');
prompt([
{
type: 'input',
name: 'name',
message: 'What do you want to call the environment?',
initial: cli_helper_1.Cli.commandArg2 || '',
validate: function (input) {
return /^[a-z0-9]{1,12}$/i.test(input);
}
},
{
type: 'input',
name: 'defaultDomain',
message: 'Default Domain (optional)',
result: function (input) {
return input.trim();
}
async function runSetup() {
clear();
console.log(
chalk.red(
figlet.textSync('Static Site Boilerplate', { horizontalLayout: 'fitted' })
)
);
const questions = await prompt([
{
type: 'input',
name: 'site_name',
message: 'What is the name of your website?',
initial: 'Static Site Boilerplate'
},
{
type: 'input',
name: 'site_description',
message: 'What is a description of your website?',
initial: 'A modern boilerplate for static website development'
},
{
type: 'input',
name: 'site_url',
message: 'What is the live URL for your website?',
async run() {
const { flags } = this.parse(ChannelUpdate);
try {
const { name } = await credentials(this);
if (!flags.channel || !flags.type) {
const res = await prompt([
{
type: 'input',
name: 'channel',
message: `What is the unique identifier for the channel?`,
required: true,
},
{
type: 'select',
name: 'type',
message: 'What type of channel is this?',
required: true,
choices: [
{ message: 'Livestream', value: 'livestream' },
{ message: 'Messaging', value: 'messaging' },
{ message: 'Gaming', value: 'gaming' },
{ message: 'Commerce', value: 'commerce' },
async run() {
const { flags } = this.parse(ChannelRemove);
try {
if (!flags.channel || !flags.type) {
const res = await prompt([
{
type: 'input',
name: 'channel',
message: `What is the unique identifier for the channel?`,
required: true,
},
{
type: 'select',
name: 'type',
message: 'What type of channel is this?',
required: true,
choices: [
{ message: 'Livestream', value: 'livestream' },
{ message: 'Messaging', value: 'messaging' },
{ message: 'Gaming', value: 'gaming' },
{ message: 'Commerce', value: 'commerce' },
const flagsInput = flags.map(flag => {
if (Array.isArray(flag)) {
return {
name: `--${flag[0]}`,
type: 'input',
initial: `${flag[1]}`,
}
}
return {
name: `--${flag}`,
type: 'input',
}
})
const res = await prompt(flagsInput)
return flags.map(f => {
if (Array.isArray(f)) {
return res[`--${f[0]}`]
}
return res[`--${f}`]
})
}
async run() {
const { flags } = this.parse(MessageUnflag);
try {
if (!flags.message) {
const res = await prompt([
{
type: 'input',
name: 'message',
message:
'What is the unique identifier for the message?',
required: true,
},
]);
flags.message = res.message;
}
const client = await chatAuth(this);
const response = client.unflagMessage(flags.message);
if (flags.json) {
async run() {
const { flags } = this.parse(UserCreate);
try {
if (!flags.user || !flags.role) {
const res = await prompt([
{
type: 'input',
name: 'user',
message: 'What is the unique identifier for the user?',
required: true,
},
{
type: 'select',
name: 'role',
message: 'What role would you like assign to the user?',
required: true,
choices: [
{
message: 'Admin',
value: 'admin',
},