From 661c02903664b98cb00e014b46c9df5381f1231c Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Tue, 12 Sep 2017 18:05:00 +0200 Subject: [PATCH] Make createUsage a bit easier to read --- src/cli-util.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/cli-util.js b/src/cli-util.js index c5bccb69e..8981e21ff 100644 --- a/src/cli-util.js +++ b/src/cli-util.js @@ -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]