UNPKG

@kontent-ai/model-generator

Version:

This utility generates strongly-typed models for Delivery JS SDK, Migration toolkit or just general scripting to improve the experience when referencing Kontent.ai related objects.

36 lines 1.21 kB
import yargs from "yargs"; import { hideBin } from "yargs/helpers"; export function argumentsSetter() { const argv = yargs(hideBin(process.argv)); return { withCommand(command) { argv.command(command.name, command.description, (yargs) => { for (const example of command.examples) { yargs.example(command.name, example); } command.options.forEach((option) => { yargs.positional(option.name, { alias: option.alias, describe: option.description, type: option.type, demandOption: option.isRequired, }); }); }); return this; }, withOption(option) { argv.option(option.name, { alias: option.alias, description: option.description, type: option.type, demandOption: option.isRequired, }); return this; }, registerCommands() { argv.parseSync(); }, }; } //# sourceMappingURL=args-setter.js.map