@tsed/cli-core
Version:
Build your CLI with TypeScript and Decorators
15 lines (14 loc) • 477 B
JavaScript
export function mapCommanderOptions(commandName, commands) {
const options = {};
commands.forEach((command) => {
if (command.name() !== commandName) {
return;
}
Object.entries(command.opts())
.filter(([key]) => !key.startsWith("_") && !["commands", "options", "parent", "rawArgs", "args"].includes(key))
.forEach(([key, value]) => {
options[key] = value;
});
});
return options;
}