diff --git a/package.json b/package.json index 5f2f01a..853bf20 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package", "name": "@kevisual/router", - "version": "0.0.87", + "version": "0.0.88", "description": "", "type": "module", "main": "./dist/router.js", diff --git a/src/commander.ts b/src/commander.ts index 3fb672d..0146436 100644 --- a/src/commander.ts +++ b/src/commander.ts @@ -1,5 +1,5 @@ import { program } from 'commander'; -import { App } from './app.ts'; +import { App, QueryRouterServer } from './app.ts'; export const groupByPath = (routes: App['routes']) => { return routes.reduce((acc, route) => { @@ -103,10 +103,8 @@ export const createCommand = (opts: { app: App, program: typeof program }) => { } } -program.parse(process.argv); - -export const parse = (opts: { app: App, description?: string, parse?: boolean }) => { - const { app, description, parse } = opts; +export const parse = (opts: { app: QueryRouterServer, description?: string, parse?: boolean }) => { + const { app, description, parse = true } = opts; program.description(description || 'Router 命令行工具'); createCommand({ app: app as App, program }); if (parse) {