Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const provider = providers[providerName];
if (argv['--help']) {
provider.help();
process.exit(0);
}
// the context object to supply to the providers or the commands
const ctx: CliContext = {
config: null, // FIXME
argv,
};
try {
const method = get(provider, camelcase(subcommand));
if (method) {
await (provider as any)[camelcase(subcommand)](ctx);
} else {
const subcommands = Array.from(provider.subcommands).join(', ');
error(`Please specify a valid subcommand: ${subcommands}`);
provider.help();
}
} catch (err) {
console.error(
error(
`An unexpected error occurred in provider ${subcommand}: ${err.stack}`
)
);
}
};
if (argv['--help']) {
provider.help();
process.exit(0);
}
// the context object to supply to the providers or the commands
const ctx: CliContext = {
config: null, // FIXME
argv,
};
try {
const method = get(provider, camelcase(subcommand));
if (method) {
await (provider as any)[camelcase(subcommand)](ctx);
} else {
const subcommands = Array.from(provider.subcommands).join(', ');
error(`Please specify a valid subcommand: ${subcommands}`);
provider.help();
}
} catch (err) {
console.error(
error(
`An unexpected error occurred in provider ${subcommand}: ${err.stack}`
)
);
}
};