Skip to content

Commit

Permalink
fix(help): parameter format (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
fXy-during authored Apr 9, 2020
1 parent 329c4a5 commit b3bb4a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/feflow-cli/src/core/devkit/commandOptions.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
6 changes: 5 additions & 1 deletion packages/feflow-cli/src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit b3bb4a4

Please sign in to comment.