refactor: adjust category
parent
b51135d9fd
commit
b9bc54aab6
|
@ -97,7 +97,7 @@ const detailOptions = normalizeDetailOptions({
|
|||
},
|
||||
"find-config-path": {
|
||||
type: "path",
|
||||
category: "config",
|
||||
category: "command",
|
||||
description:
|
||||
"Finds and prints the path to a configuration file for a given input file."
|
||||
},
|
||||
|
@ -110,6 +110,7 @@ const detailOptions = normalizeDetailOptions({
|
|||
},
|
||||
help: {
|
||||
type: "boolean",
|
||||
category: "command",
|
||||
alias: "h",
|
||||
description: "Show help."
|
||||
},
|
||||
|
@ -130,6 +131,7 @@ const detailOptions = normalizeDetailOptions({
|
|||
},
|
||||
"list-different": {
|
||||
type: "boolean",
|
||||
category: "command",
|
||||
alias: "l",
|
||||
description:
|
||||
"Print filenames of files that are different from Prettier formatting."
|
||||
|
@ -242,6 +244,7 @@ const detailOptions = normalizeDetailOptions({
|
|||
},
|
||||
version: {
|
||||
type: "boolean",
|
||||
category: "command",
|
||||
alias: "v",
|
||||
description: "Print Prettier version."
|
||||
},
|
||||
|
@ -252,6 +255,7 @@ const detailOptions = normalizeDetailOptions({
|
|||
},
|
||||
write: {
|
||||
type: "boolean",
|
||||
category: "command",
|
||||
description: "Edit the file in-place. (Beware!)"
|
||||
}
|
||||
});
|
||||
|
@ -305,6 +309,7 @@ function normalizeDetailOptions(rawDetailOptions) {
|
|||
const option = rawDetailOptions[name];
|
||||
return Object.assign({}, option, {
|
||||
name,
|
||||
category: option.category || "other",
|
||||
forwardToApi:
|
||||
option.forwardToApi &&
|
||||
(typeof option.forwardToApi === "string"
|
||||
|
|
|
@ -328,7 +328,7 @@ function createUsage() {
|
|||
const options = constant.detailOptions.filter(option => !option.hidden);
|
||||
|
||||
const groupedUsages = options.reduce((current, option) => {
|
||||
const category = capitalize(option.category || "uncategorized");
|
||||
const category = capitalize(option.category);
|
||||
const group = (current[category] = current[category] || []);
|
||||
group.push(createOptionUsage(option, 25));
|
||||
return current;
|
||||
|
|
|
@ -3,6 +3,15 @@
|
|||
exports[`show usage with --help 1`] = `
|
||||
"Usage: prettier [opts] [filename ...]
|
||||
|
||||
Command options:
|
||||
|
||||
--find-config-path <path>
|
||||
Finds and prints the path to a configuration file for a given input file.
|
||||
--help or -h Show help.
|
||||
--list-different or -l Print filenames of files that are different from Prettier formatting.
|
||||
--version or -v Print Prettier version.
|
||||
--write Edit the file in-place. (Beware!)
|
||||
|
||||
Config options:
|
||||
|
||||
--config <path> Path to a prettier configuration file (.prettierrc, package.json, prettier.config.js).
|
||||
|
@ -13,8 +22,6 @@ 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 <path>
|
||||
Finds and prints the path to a configuration file for a given input file.
|
||||
--ignore-path <path> Path to a file containing patterns that describe files to ignore.
|
||||
Defaults to ./.prettierignore.
|
||||
--no-config Do not look for a configuration file.
|
||||
|
@ -42,17 +49,13 @@ Format options:
|
|||
Print trailing commas wherever possible when multi-line. Defaults to none.
|
||||
--use-tabs Indent lines with tabs instead of spaces.
|
||||
|
||||
Uncategorized options:
|
||||
Other options:
|
||||
|
||||
--cursor-offset <int> 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 filenames of files that are different from Prettier formatting.
|
||||
--no-color Do not colorize error messages.
|
||||
--stdin Read input from stdin.
|
||||
--stdin-filepath <path> Path to the file used to read from stdin.
|
||||
--version or -v Print Prettier version.
|
||||
--write Edit the file in-place. (Beware!)
|
||||
|
||||
|
||||
"
|
||||
|
@ -61,6 +64,15 @@ Uncategorized options:
|
|||
exports[`throw error and show usage with something unexpected 1`] = `
|
||||
"Usage: prettier [opts] [filename ...]
|
||||
|
||||
Command options:
|
||||
|
||||
--find-config-path <path>
|
||||
Finds and prints the path to a configuration file for a given input file.
|
||||
--help or -h Show help.
|
||||
--list-different or -l Print filenames of files that are different from Prettier formatting.
|
||||
--version or -v Print Prettier version.
|
||||
--write Edit the file in-place. (Beware!)
|
||||
|
||||
Config options:
|
||||
|
||||
--config <path> Path to a prettier configuration file (.prettierrc, package.json, prettier.config.js).
|
||||
|
@ -71,8 +83,6 @@ 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 <path>
|
||||
Finds and prints the path to a configuration file for a given input file.
|
||||
--ignore-path <path> Path to a file containing patterns that describe files to ignore.
|
||||
Defaults to ./.prettierignore.
|
||||
--no-config Do not look for a configuration file.
|
||||
|
@ -100,17 +110,13 @@ Format options:
|
|||
Print trailing commas wherever possible when multi-line. Defaults to none.
|
||||
--use-tabs Indent lines with tabs instead of spaces.
|
||||
|
||||
Uncategorized options:
|
||||
Other options:
|
||||
|
||||
--cursor-offset <int> 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 filenames of files that are different from Prettier formatting.
|
||||
--no-color Do not colorize error messages.
|
||||
--stdin Read input from stdin.
|
||||
--stdin-filepath <path> Path to the file used to read from stdin.
|
||||
--version or -v Print Prettier version.
|
||||
--write Edit the file in-place. (Beware!)
|
||||
|
||||
|
||||
"
|
||||
|
|
Loading…
Reference in New Issue