/
githubmirror
/
taro
Обзор
Документация
Войти
/
githubmirror
/
taro
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/taro-cli/src/commands/customCommand.ts
26 строк
576 B
ZEJIA LIU
Feat/cli global plugin (#13693)
21 апр 2023, 11:47
Не верифицирован
21 апр 2023, 11:47
921b185
Код
Авторство
О чём код?
import { Kernel } from '@tarojs/service' export default function customCommand ( command: string, kernel: Kernel, args: { _: string[], [key: string]: any } ) { if (typeof command === 'string') { const options: any = {} const excludeKeys = ['_', 'version', 'v', 'help', 'h', 'disable-global-config'] Object.keys(args).forEach(key => { if (!excludeKeys.includes(key)) { options[key] = args[key] } }) kernel.run({ name: command, opts: { _: args._, options, isHelp: args.h } }) } }