diff --git a/src/cli-constant.js b/src/cli-constant.js index d32a802d7..39c2530d8 100644 --- a/src/cli-constant.js +++ b/src/cli-constant.js @@ -1,6 +1,5 @@ "use strict"; -const CATEGORY_COMMAND = "Command"; const CATEGORY_CONFIG = "Config"; const CATEGORY_FORMAT = "Format"; const CATEGORY_OTHER = "Other"; @@ -115,7 +114,7 @@ const detailedOptions = normalizeDetailedOptions({ }, "find-config-path": { type: "path", - category: CATEGORY_COMMAND, + category: CATEGORY_CONFIG, description: "Find and print the path to a configuration file for the given input file." }, @@ -127,7 +126,6 @@ const detailedOptions = normalizeDetailedOptions({ }, help: { type: "boolean", - category: CATEGORY_COMMAND, alias: "h", description: "Show help." }, @@ -148,7 +146,6 @@ const detailedOptions = normalizeDetailedOptions({ }, "list-different": { type: "boolean", - category: CATEGORY_COMMAND, alias: "l", description: "Print the names of files that are different from Prettier's formatting." @@ -170,7 +167,6 @@ const detailedOptions = normalizeDetailedOptions({ }, "range-end": { type: "int", - category: CATEGORY_FORMAT, forwardToApi: true, exception: Infinity, description: dedent(` @@ -182,7 +178,6 @@ const detailedOptions = normalizeDetailedOptions({ }, "range-start": { type: "int", - category: CATEGORY_FORMAT, forwardToApi: true, description: dedent(` Format code starting at a given character offset. @@ -240,7 +235,6 @@ const detailedOptions = normalizeDetailedOptions({ }, version: { type: "boolean", - category: CATEGORY_COMMAND, alias: "v", description: "Print Prettier version." }, @@ -251,7 +245,6 @@ const detailedOptions = normalizeDetailedOptions({ }, write: { type: "boolean", - category: CATEGORY_COMMAND, description: "Edit files in-place. (Beware!)" } }); @@ -325,7 +318,6 @@ const detailedOptionMap = detailedOptions.reduce( ); module.exports = { - CATEGORY_COMMAND, CATEGORY_CONFIG, CATEGORY_FORMAT, CATEGORY_OTHER, diff --git a/src/cli-util.js b/src/cli-util.js index e640ec388..b5fca9e3f 100644 --- a/src/cli-util.js +++ b/src/cli-util.js @@ -347,11 +347,7 @@ function createUsage() { const usageSummary = "Usage: prettier [opts] [filename ...]"; - const firstCategories = [ - constant.CATEGORY_COMMAND, - constant.CATEGORY_FORMAT, - constant.CATEGORY_CONFIG - ]; + const firstCategories = [constant.CATEGORY_FORMAT, constant.CATEGORY_CONFIG]; const lastCategories = [constant.CATEGORY_OTHER]; const restCategories = Object.keys(groupedOptions).filter( category => diff --git a/tests_integration/__tests__/__snapshots__/early-exit.js.snap b/tests_integration/__tests__/__snapshots__/early-exit.js.snap index 4de34e4a8..de9950692 100644 --- a/tests_integration/__tests__/__snapshots__/early-exit.js.snap +++ b/tests_integration/__tests__/__snapshots__/early-exit.js.snap @@ -3,15 +3,6 @@ exports[`show usage with --help 1`] = ` "Usage: prettier [opts] [filename ...] -Command options: - - --find-config-path - Find and print the path to a configuration file for the given input file. - --help or -h Show help. - --list-different or -l Print the names of files that are different from Prettier's formatting. - --version or -v Print Prettier version. - --write Edit files in-place. (Beware!) - Format options: --no-bracket-spacing Do not print spaces between brackets. @@ -19,14 +10,6 @@ Format options: --parser Which parser to use. Defaults to babylon. --print-width The line length where Prettier will try wrap. Defaults to 80. - --range-end Format code ending at a given character offset (exclusive). - The range will extend forwards to the end of the selected statement. - This option cannot be used with --cursor-offset. - Defaults to Infinity. - --range-start Format code starting at a given character offset. - The range will extend backwards to the start of the first line containing the selected statement. - This option cannot be used with --cursor-offset. - Defaults to 0. --no-semi Do not print semicolons, except at the beginning of lines which may need them. --single-quote Use single quotes instead of double quotes. --tab-width Number of spaces per indentation level. Defaults to 2. @@ -45,6 +28,8 @@ Config options: prefer-file | default config => config file (if config file is found) or default config => CLI options (if no config file is found) Defaults to cli-override. + --find-config-path + Find and print the path to a configuration file for the given input file. --ignore-path Path to a file with patterns describing files to ignore. Defaults to ./.prettierignore. --with-node-modules Process files inside 'node_modules' directory. @@ -54,8 +39,20 @@ Other options: --no-color Do not colorize error messages. --cursor-offset Print (to stderr) where a cursor at the given position would move to after formatting. This option cannot be used with --range-start and --range-end. + --help or -h Show help. + --list-different or -l Print the names of files that are different from Prettier's formatting. + --range-end Format code ending at a given character offset (exclusive). + The range will extend forwards to the end of the selected statement. + This option cannot be used with --cursor-offset. + Defaults to Infinity. + --range-start Format code starting at a given character offset. + The range will extend backwards to the start of the first line containing the selected statement. + This option cannot be used with --cursor-offset. + Defaults to 0. --stdin Read input from stdin. --stdin-filepath Path to the file to pretend that stdin comes from. + --version or -v Print Prettier version. + --write Edit files in-place. (Beware!) " @@ -64,15 +61,6 @@ Other options: exports[`throw error and show usage with something unexpected 1`] = ` "Usage: prettier [opts] [filename ...] -Command options: - - --find-config-path - Find and print the path to a configuration file for the given input file. - --help or -h Show help. - --list-different or -l Print the names of files that are different from Prettier's formatting. - --version or -v Print Prettier version. - --write Edit files in-place. (Beware!) - Format options: --no-bracket-spacing Do not print spaces between brackets. @@ -80,14 +68,6 @@ Format options: --parser Which parser to use. Defaults to babylon. --print-width The line length where Prettier will try wrap. Defaults to 80. - --range-end Format code ending at a given character offset (exclusive). - The range will extend forwards to the end of the selected statement. - This option cannot be used with --cursor-offset. - Defaults to Infinity. - --range-start Format code starting at a given character offset. - The range will extend backwards to the start of the first line containing the selected statement. - This option cannot be used with --cursor-offset. - Defaults to 0. --no-semi Do not print semicolons, except at the beginning of lines which may need them. --single-quote Use single quotes instead of double quotes. --tab-width Number of spaces per indentation level. Defaults to 2. @@ -106,6 +86,8 @@ Config options: prefer-file | default config => config file (if config file is found) or default config => CLI options (if no config file is found) Defaults to cli-override. + --find-config-path + Find and print the path to a configuration file for the given input file. --ignore-path Path to a file with patterns describing files to ignore. Defaults to ./.prettierignore. --with-node-modules Process files inside 'node_modules' directory. @@ -115,8 +97,20 @@ Other options: --no-color Do not colorize error messages. --cursor-offset Print (to stderr) where a cursor at the given position would move to after formatting. This option cannot be used with --range-start and --range-end. + --help or -h Show help. + --list-different or -l Print the names of files that are different from Prettier's formatting. + --range-end Format code ending at a given character offset (exclusive). + The range will extend forwards to the end of the selected statement. + This option cannot be used with --cursor-offset. + Defaults to Infinity. + --range-start Format code starting at a given character offset. + The range will extend backwards to the start of the first line containing the selected statement. + This option cannot be used with --cursor-offset. + Defaults to 0. --stdin Read input from stdin. --stdin-filepath Path to the file to pretend that stdin comes from. + --version or -v Print Prettier version. + --write Edit files in-place. (Beware!) "