UNPKG

@kubernetes-models/crd-generate

Version:
44 lines 1.23 kB
import yargs from "yargs"; import { readInput } from "@kubernetes-models/read-input"; import { generate } from "./generate.js"; async function readFiles(paths) { const documents = await Promise.all(paths.map(async (path) => { console.log("Reading:", path); return 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 n/no-process-exit process.exit(1); } } //# sourceMappingURL=cli.js.map