Skip to content

Commit

Permalink
feat: 增加生成步骤提示
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudcome committed Mar 15, 2023
1 parent e0e439b commit b0aad3a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/generator.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import chalk from 'chalk';
import { cosmiconfig } from 'cosmiconfig';
import { CosmiconfigResult } from 'cosmiconfig/dist/types';
import fs from 'fs/promises';
Expand Down Expand Up @@ -34,8 +35,14 @@ export async function generateItem(oas: Oas, config: Config) {

export async function generate(config: Config) {
const { list } = config;
let step = 0;
const length = list.length;
const width = String(length).length;

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

0 comments on commit b0aad3a

Please sign in to comment.