More convert to jsx

This commit is contained in:
Endeavorance 2025-03-18 10:02:58 -04:00
parent d769e298b1
commit 0f72d048ee
8 changed files with 79 additions and 114 deletions

View file

@ -13,11 +13,9 @@ export interface CLIArguments {
inputFilePath: string;
options: {
write: boolean;
check: boolean;
outfile: string;
help: boolean;
minify: boolean;
renderer: Renderer;
watch: boolean;
};
@ -35,11 +33,6 @@ export function parseCLIArguments(argv: string[]): CLIArguments {
const { values: options, positionals: args } = parseArgs({
args: argv,
options: {
write: {
short: "w",
type: "boolean",
default: false,
},
check: {
short: "c",
type: "boolean",
@ -48,18 +41,13 @@ export function parseCLIArguments(argv: string[]): CLIArguments {
outfile: {
short: "o",
type: "string",
default: "playbill.json",
default: "",
},
help: {
short: "h",
default: false,
type: "boolean",
},
minify: {
short: "m",
default: false,
type: "boolean",
},
renderer: {
short: "r",
default: "json",
@ -75,8 +63,8 @@ export function parseCLIArguments(argv: string[]): CLIArguments {
});
// -- ARG VALIDATION -- //
if (options.check && options.write) {
throw new CLIError("Cannot use --check and --write together");
if (options.check && options.outfile !== "") {
throw new CLIError("Cannot use --check and --outfile together");
}
const parsedRenderer = RendererSchema.safeParse(options.renderer);
@ -89,11 +77,9 @@ export function parseCLIArguments(argv: string[]): CLIArguments {
inputFilePath: args[0] ?? "./binding.yaml",
options: {
write: options.write,
check: options.check,
outfile: options.outfile,
help: options.help,
minify: options.minify,
renderer: parsedRenderer.data,
watch: options.watch,
},