Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
program.parse(process.argv);
const subCommandName = process.argv[2];
const subCommand =
subCommandName &&
program.commands.find(({ _name, _aliases }) => {
return _name === subCommandName || (_aliases && _aliases.includes(subCommandName));
});
if (!subCommand) {
subCommandName &&
console.log(
chalk.bold.green(subCommandName),
chalk.red('is not an expotools command. See below for the full list of commands.\n')
);
program.help();
}
} catch (e) {
console.error(chalk.red(e));
throw e;
}
}