diff --git a/packages/feflow-cli/src/core/devkit/commandOptions.ts b/packages/feflow-cli/src/core/devkit/commandOptions.ts index b3cae099..acf8f9ad 100644 --- a/packages/feflow-cli/src/core/devkit/commandOptions.ts +++ b/packages/feflow-cli/src/core/devkit/commandOptions.ts @@ -1,4 +1,6 @@ -const getOptionFromCommand = (optionsDescription: object): Object[] => { +const getOptionFromCommand = (optionsDescription: any): Object[] => { + if(Array.isArray(optionsDescription)) return optionsDescription; + const options: Object[] = []; const optionDescritions = Object.keys(optionsDescription); diff --git a/packages/feflow-cli/src/core/index.ts b/packages/feflow-cli/src/core/index.ts index b98fa0c2..f8420096 100644 --- a/packages/feflow-cli/src/core/index.ts +++ b/packages/feflow-cli/src/core/index.ts @@ -9,6 +9,7 @@ import Table from 'easy-table'; import spawn from 'cross-spawn'; import loadPlugins from './plugin/loadPlugins'; import loadDevkits from './devkit/loadDevkits'; +import getOptionFromCommand from './devkit/commandOptions'; import { FEFLOW_ROOT } from '../shared/constant'; import { safeDump, parseYaml } from '../shared/yaml'; import packageJson from '../shared/packageJson'; @@ -376,9 +377,12 @@ export default class Feflow { if (registriedCommand && registriedCommand.options) { cmdDescription = registriedCommand.desc; - optionDescrition.optionList = registriedCommand.options; + optionDescrition.optionList = getOptionFromCommand(registriedCommand.options); } + if (cmd === "help") { + return registriedCommand.call(this, ctx) + } if(optionDescrition.optionList.length == 0) { ctx.logger.warn(`Current command dosen't have help message`); return;