Skip to content

Commit 561c63a

Browse files
authored
Merge pull request #45 from cloudcome/feat/v0.x
feat: 增加生成步骤提示
2 parents 9436410 + b0aad3a commit 561c63a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/generator.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import chalk from 'chalk';
12
import { cosmiconfig } from 'cosmiconfig';
23
import { CosmiconfigResult } from 'cosmiconfig/dist/types';
34
import fs from 'fs/promises';
@@ -34,8 +35,14 @@ export async function generateItem(oas: Oas, config: Config) {
3435

3536
export async function generate(config: Config) {
3637
const { list } = config;
38+
let step = 0;
39+
const length = list.length;
40+
const width = String(length).length;
3741

3842
for (const oas of list) {
43+
step++;
44+
const stepText = String(step).padStart(width, '0');
45+
console.log(chalk.cyanBright(`[${stepText}/${length}]`), 'generating', chalk.yellow(oas.name));
3946
await generateItem(oas, config);
4047
}
4148
}

0 commit comments

Comments
 (0)