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