Make createUsage a bit easier to read
This commit is contained in:
1 parent
4e5c808730
commit
661c029036
1 file changed
+6
-7
+6
-7
@@ -328,6 +328,7 @@ function formatFiles(argv) {
|
|||||||
|
|
||||||
function createUsage() {
|
function createUsage() {
|
||||||
const options = constant.detailOptions;
|
const options = constant.detailOptions;
|
||||||
|
// Add --no-foo after --foo.
|
||||||
const optionsWithOpposites = options.map(option => [
|
const optionsWithOpposites = options.map(option => [
|
||||||
option.description ? option : null,
|
option.description ? option : null,
|
||||||
option.oppositeDescription
|
option.oppositeDescription
|
||||||
@@ -352,14 +353,12 @@ function createUsage() {
|
|||||||
constant.CATEGORY_CONFIG
|
constant.CATEGORY_CONFIG
|
||||||
];
|
];
|
||||||
const lastCategories = [constant.CATEGORY_OTHER];
|
const lastCategories = [constant.CATEGORY_OTHER];
|
||||||
const allCategories = firstCategories.concat(
|
const restCategories = Object.keys(groupedOptions).filter(
|
||||||
Object.keys(groupedOptions).filter(
|
category =>
|
||||||
category =>
|
firstCategories.indexOf(category) === -1 &&
|
||||||
firstCategories.indexOf(category) === -1 &&
|
lastCategories.indexOf(category) === -1
|
||||||
lastCategories.indexOf(category) === -1
|
|
||||||
),
|
|
||||||
lastCategories
|
|
||||||
);
|
);
|
||||||
|
const allCategories = firstCategories.concat(restCategories, lastCategories);
|
||||||
|
|
||||||
const optionsUsage = allCategories.map(category => {
|
const optionsUsage = allCategories.map(category => {
|
||||||
const categoryOptions = groupedOptions[category]
|
const categoryOptions = groupedOptions[category]
|
||||||
|
|||||||
Reference in new issue
Block a user