From b0aad3ae202c125caacdb3629556fd8122e2c2e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=23=E4=BA=91=E6=B7=A1=E7=84=B6?= Date: Thu, 16 Mar 2023 03:02:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=AD=A5=E9=AA=A4=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/generator.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/generator.ts b/src/generator.ts index ff5bff2..1a2321d 100644 --- a/src/generator.ts +++ b/src/generator.ts @@ -1,3 +1,4 @@ +import chalk from 'chalk'; import { cosmiconfig } from 'cosmiconfig'; import { CosmiconfigResult } from 'cosmiconfig/dist/types'; import fs from 'fs/promises'; @@ -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); } }