UNPKG

@kubernetes-models/crd-generate

Version:
45 lines 1.23 kB
import yargs from "yargs"; import { readInput } from "@kubernetes-models/read-input"; import { generate } from "./generate.mjs"; async function readFiles(paths) { const documents = []; for (const path of paths) { console.log("Reading:", path); documents.push(await readInput(path)); } return documents.join("\n---\n"); } export async function run() { const args = await yargs .pkgConf("crd-generate") .option("input", { type: "array", describe: "Path of the input file or URL", string: true, demandOption: true }) .option("output", { type: "string", describe: "Path of output files", demandOption: true }) .option("yamlVersion", { type: "string", describe: "YAML version.", choices: ["1.0", "1.1", "1.2"] }) .parse(); try { await generate({ input: await readFiles(args.input), outputPath: args.output, yamlVersion: args.yamlVersion }); } catch (err) { console.error(err); // eslint-disable-next-line no-process-exit process.exit(1); } } //# sourceMappingURL=cli.mjs.map