@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.
34 lines • 1.17 kB
JavaScript
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) => {
command.examples.forEach((example) => 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