Skip to content

Commit

Permalink
Respect silent option by only logging errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiina authored and smorimoto committed Oct 18, 2024
1 parent 998078b commit 5f3870e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 6 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ const generateTemplatesCommand = defineCommand({
},
},
run: async ({ args }) => {
if (args.debug) consola.level = Number.MAX_SAFE_INTEGER;
if (args.silent) consola.level = 0;

await generateTemplates({
cleanOutput: args["clean-output"],
httpClientType: args["http-client"],
Expand Down Expand Up @@ -270,6 +273,9 @@ const generateCommand = defineCommand({
},
},
run: async ({ args }) => {
if (args.debug) consola.level = Number.MAX_SAFE_INTEGER;
if (args.silent) consola.level = 0;

let customConfig = null;
let customConfigPath: string | undefined;

Expand Down
4 changes: 0 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import { consola } from "consola";
import type { GenerateApiConfiguration } from "../types/index.js";
import { CodeGenProcess } from "./code-gen-process.js";

export async function generateApi(
config: Partial<GenerateApiConfiguration["config"]>,
) {
if (config.debug) {
consola.level = Number.MAX_SAFE_INTEGER;
}
const codeGenProcess = new CodeGenProcess(config);
return await codeGenProcess.start();
}
Expand Down

0 comments on commit 5f3870e

Please sign in to comment.