Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(devkit): support plugin/devkit sub command help (#207)
* feat: help command in plugin * feat: add option description to plugin-template * test: lerna run test * feat(action): test workflow * feat: github action publish * feat(actions): add feflowbot account * feat: merge help command * feat: combine plugin and devkit help command * feat: remove workflow files Co-authored-by: bethonxyfu <bethonxyfu@tencent.com>
- Loading branch information
1 parent
2e1fdd9
commit 17be24d
Showing
5 changed files
with
92 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const getOptionFromCommand = (optionsDescription: object): Object[] => { | ||
const options: Object[] = []; | ||
|
||
const optionDescritions = Object.keys(optionsDescription); | ||
if (!optionDescritions.length) return options; | ||
|
||
optionDescritions.forEach(option => { | ||
let optionItemConfig = optionsDescription[option]; | ||
const optionDescritionItem = getOptionItem(optionItemConfig, option); | ||
options.push(optionDescritionItem); | ||
}); | ||
|
||
return options; | ||
}; | ||
|
||
const getOptionItem = (optionItemConfig: any, option: any): object => { | ||
let optionDescritionItem: any = {}; | ||
if (typeof optionItemConfig == 'string') { | ||
optionDescritionItem = { | ||
name: option, | ||
description: optionItemConfig, | ||
}; | ||
} else { | ||
if (!optionItemConfig.name) { | ||
optionItemConfig.name = option; | ||
} | ||
|
||
optionDescritionItem = optionItemConfig; | ||
optionDescritionItem.type = String; | ||
} | ||
return optionDescritionItem; | ||
}; | ||
|
||
export default getOptionFromCommand; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters