Skip to content

Commit e1963a0

Browse files
authored
Merge pull request #954 from Kiina/patch-1
Respect silent option by only logging errors
2 parents 90e70dc + 5f3870e commit e1963a0

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ const generateTemplatesCommand = defineCommand({
5353
},
5454
},
5555
run: async ({ args }) => {
56+
if (args.debug) consola.level = Number.MAX_SAFE_INTEGER;
57+
if (args.silent) consola.level = 0;
58+
5659
await generateTemplates({
5760
cleanOutput: args["clean-output"],
5861
httpClientType: args["http-client"],
@@ -270,6 +273,9 @@ const generateCommand = defineCommand({
270273
},
271274
},
272275
run: async ({ args }) => {
276+
if (args.debug) consola.level = Number.MAX_SAFE_INTEGER;
277+
if (args.silent) consola.level = 0;
278+
273279
let customConfig = null;
274280
let customConfigPath: string | undefined;
275281

src/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
import { consola } from "consola";
21
import type { GenerateApiConfiguration } from "../types/index.js";
32
import { CodeGenProcess } from "./code-gen-process.js";
43

54
export async function generateApi(
65
config: Partial<GenerateApiConfiguration["config"]>,
76
) {
8-
if (config.debug) {
9-
consola.level = Number.MAX_SAFE_INTEGER;
10-
}
117
const codeGenProcess = new CodeGenProcess(config);
128
return await codeGenProcess.start();
139
}

0 commit comments

Comments
 (0)