Make createUsage a bit easier to read

This commit is contained in:
Simon Lydell authored and Ika committed 2017-09-13 18:21:04 +08:00
1 parent 4e5c808730
commit 661c029036
1 file changed
+6 -7
+6 -7
View File
@@ -328,6 +328,7 @@ function formatFiles(argv) {
function createUsage() {
const options = constant.detailOptions;
// Add --no-foo after --foo.
const optionsWithOpposites = options.map(option => [
option.description ? option : null,
option.oppositeDescription
@@ -352,14 +353,12 @@ function createUsage() {
constant.CATEGORY_CONFIG
];
const lastCategories = [constant.CATEGORY_OTHER];
const allCategories = firstCategories.concat(
Object.keys(groupedOptions).filter(
category =>
firstCategories.indexOf(category) === -1 &&
lastCategories.indexOf(category) === -1
),
lastCategories
const restCategories = Object.keys(groupedOptions).filter(
category =>
firstCategories.indexOf(category) === -1 &&
lastCategories.indexOf(category) === -1
);
const allCategories = firstCategories.concat(restCategories, lastCategories);
const optionsUsage = allCategories.map(category => {
const categoryOptions = groupedOptions[category]