UNPKG

@tarojs/cli

Version:
27 lines (24 loc) 576 B
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 } }) } }