diff --git a/Cargo.lock b/Cargo.lock index e56ec35d295..8eb3b6f1c1f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -152,18 +152,18 @@ checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" [[package]] name = "bpaf" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72974597bfc83173d714c0fc785a8ab64ca0f0896cb72b05f2f4c5e682543871" +checksum = "affa4185035a12636b90d7064d64fff3cca6ff5a2f65c3325a7eef0da2f272bb" dependencies = [ "bpaf_derive", ] [[package]] name = "bpaf_derive" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6b7be5dcfd7bb931b9932e689c69a9b9f50a46cf0b588c90ed73ec28e8e0bf4" +checksum = "ac88f5e10b620a207805c5a6f538a7777dc55e5469bbc0eec27e2bf75d5ee0f6" dependencies = [ "proc-macro2", "quote", @@ -3338,6 +3338,7 @@ dependencies = [ "quote", "rome_analyze", "rome_aria", + "rome_cli", "rome_diagnostics", "rome_js_analyze", "rome_js_factory", diff --git a/Cargo.toml b/Cargo.toml index c01d1f4f37f..1985afb3a61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,7 +68,7 @@ tests_macros = { path = "./crates/tests_macros" } quickcheck_macros = "1.0.0" quickcheck = "1.0.3" bitflags = "2.3.1" -bpaf = { version = "0.9.1", features = ["derive"] } +bpaf = { version = "0.9.2", features = ["derive"] } countme = "3.0.1" dashmap = "5.4.0" indexmap = "1.9.3" diff --git a/crates/rome_cli/Cargo.toml b/crates/rome_cli/Cargo.toml index 2337b54ce7d..d6d7b152201 100644 --- a/crates/rome_cli/Cargo.toml +++ b/crates/rome_cli/Cargo.toml @@ -59,3 +59,6 @@ rome_js_formatter = { workspace = true } rome_json_formatter = { workspace = true } rome_json_parser = { workspace = true } tokio = { workspace = true, features = ["io-util"] } + +[features] +docgen = ["bpaf/docgen"] diff --git a/crates/rome_cli/src/commands/mod.rs b/crates/rome_cli/src/commands/mod.rs index 828c4042831..a0883c2fff4 100644 --- a/crates/rome_cli/src/commands/mod.rs +++ b/crates/rome_cli/src/commands/mod.rs @@ -21,8 +21,6 @@ pub(crate) mod version; #[derive(Debug, Clone, Bpaf)] #[bpaf(options, version(VERSION))] -/// Rome CLI -/// /// Rome official CLI. Use it to check the health of your project or run it to check single files. pub enum RomeCommand { /// Shows the Rome version information and quit diff --git a/crates/rome_cli/tests/snapshots/main_commands_check/check_help.snap b/crates/rome_cli/tests/snapshots/main_commands_check/check_help.snap index 5a4cc010cfc..d940f2f87a4 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_check/check_help.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_check/check_help.snap @@ -14,7 +14,7 @@ The configuration that is contained inside the file `rome.json` --vcs-enabled= Whether Rome should integrate itself with the VCS client --vcs-use-ignore-file= Whether Rome should use the VCS ignore file. When [true], Rome will ignore the files specified in the ignore file. - --vcs-root=PATH The folder where Rome should check for VCS files. By default, Rome will + --vcs-root=PATH The folder where Rome should check for VCS files. By default, Rome will use the same folder where `rome.json` was found. If Rome can't find the configuration, it will attempt to use the current working directory. If no current working directory can't be found, Rome @@ -24,8 +24,8 @@ The configuration that is contained inside the file `rome.json` --files-ignore-unknown= Tells Rome to not emit diagnostics when handling files that doesn't know --indent-style= The indent style. - --indent-size=NUMBER The size of the indentation, 2 by default - --line-width=NUMBER What's the max width of a line. Defaults to 80. + --indent-size=NUMBER The size of the indentation, 2 by default + --line-width=NUMBER What's the max width of a line. Defaults to 80. --quote-style= The style for quotes. Defaults to double. --jsx-quote-style= The style for JSX quotes. Defaults to double. --quote-properties= When properties in objects are quoted. Defaults to asNeeded. @@ -37,34 +37,33 @@ The configuration that is contained inside the file `rome.json` Defaults to "always". Global options applied to all commands - --colors= Set the formatting mode for markup: "off" prints everything as plain - text, "force" forces the formatting of markup using ANSI even if the console + --colors= Set the formatting mode for markup: "off" prints everything as plain text, + "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible - --use-server Connect to a running instance of the Rome daemon server. - --verbose Print additional verbose advices on diagnostics - --config-path=PATH Set the filesystem path to the directory of the rome.json configuration + --use-server Connect to a running instance of the Rome daemon server. + --verbose Print additional verbose advices on diagnostics + --config-path=PATH Set the filesystem path to the directory of the rome.json configuration file --max-diagnostics=NUMBER Cap the amount of diagnostics displayed. - [default: 20] - --skip-errors Skip over files containing syntax errors instead of emitting an error - diagnostic. + [default: 20] + --skip-errors Skip over files containing syntax errors instead of emitting an error diagnostic. --no-errors-on-unmatched Silence errors that would be emitted in case no files were processed during the execution of the command. - --error-on-warnings Tell Rome to exit with an error code if some diagnostics emit warnings. - --json Reports information using the JSON format + --error-on-warnings Tell Rome to exit with an error code if some diagnostics emit warnings. + --json Reports information using the JSON format Available positional items: - PATH Single file, single path or list of paths + PATH Single file, single path or list of paths Available options: - --apply Apply safe fixes, formatting - --apply-unsafe Apply safe fixes and unsafe fixes, formatting and import sorting + --apply Apply safe fixes, formatting + --apply-unsafe Apply safe fixes and unsafe fixes, formatting and import sorting --formatter-enabled= Allow to enable or disable the formatter check. --linter-enabled= Allow to enable or disable the linter check. --organize-imports-enabled= Allow to enable or disable the organize imports. --stdin-file-path=PATH A file name with its extension to pass when reading from standard in, e.g. echo 'let a;' | rome check --stdin-file-path=file.js" - -h, --help Prints help information + -h, --help Prints help information ``` diff --git a/crates/rome_cli/tests/snapshots/main_commands_check/files_max_size_parse_error.snap b/crates/rome_cli/tests/snapshots/main_commands_check/files_max_size_parse_error.snap index e0c939fae1e..e8c61b54dae 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_check/files_max_size_parse_error.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_check/files_max_size_parse_error.snap @@ -17,7 +17,7 @@ flags/invalid ━━━━━━━━━━━━━━━━━━━━━━ × Failed to parse CLI arguments. Caused by: - Couldn't parse `-1`: invalid digit found in string + couldn't parse `-1`: invalid digit found in string diff --git a/crates/rome_cli/tests/snapshots/main_commands_ci/ci_help.snap b/crates/rome_cli/tests/snapshots/main_commands_ci/ci_help.snap index 262ffefccda..1059bc2f7d6 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_ci/ci_help.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_ci/ci_help.snap @@ -15,7 +15,7 @@ The configuration that is contained inside the file `rome.json` --vcs-enabled= Whether Rome should integrate itself with the VCS client --vcs-use-ignore-file= Whether Rome should use the VCS ignore file. When [true], Rome will ignore the files specified in the ignore file. - --vcs-root=PATH The folder where Rome should check for VCS files. By default, Rome will + --vcs-root=PATH The folder where Rome should check for VCS files. By default, Rome will use the same folder where `rome.json` was found. If Rome can't find the configuration, it will attempt to use the current working directory. If no current working directory can't be found, Rome @@ -25,8 +25,8 @@ The configuration that is contained inside the file `rome.json` --files-ignore-unknown= Tells Rome to not emit diagnostics when handling files that doesn't know --indent-style= The indent style. - --indent-size=NUMBER The size of the indentation, 2 by default - --line-width=NUMBER What's the max width of a line. Defaults to 80. + --indent-size=NUMBER The size of the indentation, 2 by default + --line-width=NUMBER What's the max width of a line. Defaults to 80. --quote-style= The style for quotes. Defaults to double. --jsx-quote-style= The style for JSX quotes. Defaults to double. --quote-properties= When properties in objects are quoted. Defaults to asNeeded. @@ -38,30 +38,29 @@ The configuration that is contained inside the file `rome.json` Defaults to "always". Global options applied to all commands - --colors= Set the formatting mode for markup: "off" prints everything as plain - text, "force" forces the formatting of markup using ANSI even if the console + --colors= Set the formatting mode for markup: "off" prints everything as plain text, + "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible - --use-server Connect to a running instance of the Rome daemon server. - --verbose Print additional verbose advices on diagnostics - --config-path=PATH Set the filesystem path to the directory of the rome.json configuration + --use-server Connect to a running instance of the Rome daemon server. + --verbose Print additional verbose advices on diagnostics + --config-path=PATH Set the filesystem path to the directory of the rome.json configuration file --max-diagnostics=NUMBER Cap the amount of diagnostics displayed. - [default: 20] - --skip-errors Skip over files containing syntax errors instead of emitting an error - diagnostic. + [default: 20] + --skip-errors Skip over files containing syntax errors instead of emitting an error diagnostic. --no-errors-on-unmatched Silence errors that would be emitted in case no files were processed during the execution of the command. - --error-on-warnings Tell Rome to exit with an error code if some diagnostics emit warnings. - --json Reports information using the JSON format + --error-on-warnings Tell Rome to exit with an error code if some diagnostics emit warnings. + --json Reports information using the JSON format Available positional items: - PATH Single file, single path or list of paths + PATH Single file, single path or list of paths Available options: --formatter-enabled= Allow to enable or disable the formatter check. --linter-enabled= Allow to enable or disable the linter check. --organize-imports-enabled= Allow to enable or disable the organize imports. - -h, --help Prints help information + -h, --help Prints help information ``` diff --git a/crates/rome_cli/tests/snapshots/main_commands_ci/files_max_size_parse_error.snap b/crates/rome_cli/tests/snapshots/main_commands_ci/files_max_size_parse_error.snap index 44f273a7c55..e07ea373525 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_ci/files_max_size_parse_error.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_ci/files_max_size_parse_error.snap @@ -17,7 +17,7 @@ flags/invalid ━━━━━━━━━━━━━━━━━━━━━━ × Failed to parse CLI arguments. Caused by: - Couldn't parse `-1`: invalid digit found in string + couldn't parse `-1`: invalid digit found in string diff --git a/crates/rome_cli/tests/snapshots/main_commands_format/files_max_size_parse_error.snap b/crates/rome_cli/tests/snapshots/main_commands_format/files_max_size_parse_error.snap index a7a18b769fc..80c1dcc0001 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_format/files_max_size_parse_error.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_format/files_max_size_parse_error.snap @@ -17,7 +17,7 @@ flags/invalid ━━━━━━━━━━━━━━━━━━━━━━ × Failed to parse CLI arguments. Caused by: - Couldn't parse `-1`: invalid digit found in string + couldn't parse `-1`: invalid digit found in string diff --git a/crates/rome_cli/tests/snapshots/main_commands_format/format_help.snap b/crates/rome_cli/tests/snapshots/main_commands_format/format_help.snap index 902d2560946..c3596856de3 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_format/format_help.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_format/format_help.snap @@ -11,15 +11,15 @@ Usage: format [--write] [PATH]... Options applied to the formatter --indent-style= The indent style. - --indent-size=NUMBER The size of the indentation, 2 by default - --line-width=NUMBER What's the max width of a line. Defaults to 80. + --indent-size=NUMBER The size of the indentation, 2 by default + --line-width=NUMBER What's the max width of a line. Defaults to 80. Set of properties to integrate Rome with a VCS software. --vcs-client-kind= The kind of client. --vcs-enabled= Whether Rome should integrate itself with the VCS client --vcs-use-ignore-file= Whether Rome should use the VCS ignore file. When [true], Rome will ignore the files specified in the ignore file. - --vcs-root=PATH The folder where Rome should check for VCS files. By default, Rome will + --vcs-root=PATH The folder where Rome should check for VCS files. By default, Rome will use the same folder where `rome.json` was found. If Rome can't find the configuration, it will attempt to use the current working directory. If no current working directory can't be found, Rome @@ -32,24 +32,23 @@ The configuration of the filesystem doesn't know Global options applied to all commands - --colors= Set the formatting mode for markup: "off" prints everything as plain - text, "force" forces the formatting of markup using ANSI even if the console + --colors= Set the formatting mode for markup: "off" prints everything as plain text, + "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible - --use-server Connect to a running instance of the Rome daemon server. - --verbose Print additional verbose advices on diagnostics - --config-path=PATH Set the filesystem path to the directory of the rome.json configuration + --use-server Connect to a running instance of the Rome daemon server. + --verbose Print additional verbose advices on diagnostics + --config-path=PATH Set the filesystem path to the directory of the rome.json configuration file --max-diagnostics=NUMBER Cap the amount of diagnostics displayed. - [default: 20] - --skip-errors Skip over files containing syntax errors instead of emitting an error - diagnostic. + [default: 20] + --skip-errors Skip over files containing syntax errors instead of emitting an error diagnostic. --no-errors-on-unmatched Silence errors that would be emitted in case no files were processed during the execution of the command. - --error-on-warnings Tell Rome to exit with an error code if some diagnostics emit warnings. - --json Reports information using the JSON format + --error-on-warnings Tell Rome to exit with an error code if some diagnostics emit warnings. + --json Reports information using the JSON format Available positional items: - PATH Single file, single path or list of paths. + PATH Single file, single path or list of paths. Available options: --quote-style= The style for quotes. Defaults to double. @@ -63,8 +62,8 @@ Available options: Defaults to "always". --stdin-file-path=PATH A file name with its extension to pass when reading from standard in, e.g. echo 'let a;' | rome format --stdin-file-path=file.js". - --write Writes formatted files to file system. - -h, --help Prints help information + --write Writes formatted files to file system. + -h, --help Prints help information ``` diff --git a/crates/rome_cli/tests/snapshots/main_commands_format/indent_size_parse_errors_negative.snap b/crates/rome_cli/tests/snapshots/main_commands_format/indent_size_parse_errors_negative.snap index c38611d85b2..997a8a6d1fa 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_format/indent_size_parse_errors_negative.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_format/indent_size_parse_errors_negative.snap @@ -10,7 +10,7 @@ flags/invalid ━━━━━━━━━━━━━━━━━━━━━━ × Failed to parse CLI arguments. Caused by: - Couldn't parse `-1`: invalid digit found in string + couldn't parse `-1`: invalid digit found in string diff --git a/crates/rome_cli/tests/snapshots/main_commands_format/indent_size_parse_errors_overflow.snap b/crates/rome_cli/tests/snapshots/main_commands_format/indent_size_parse_errors_overflow.snap index 4cf79cdb484..3f43b1982fa 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_format/indent_size_parse_errors_overflow.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_format/indent_size_parse_errors_overflow.snap @@ -10,7 +10,7 @@ flags/invalid ━━━━━━━━━━━━━━━━━━━━━━ × Failed to parse CLI arguments. Caused by: - Couldn't parse `257`: number too large to fit in target type + couldn't parse `257`: number too large to fit in target type diff --git a/crates/rome_cli/tests/snapshots/main_commands_format/indent_style_parse_errors.snap b/crates/rome_cli/tests/snapshots/main_commands_format/indent_style_parse_errors.snap index c281e93fb7c..b2b9b58be40 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_format/indent_style_parse_errors.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_format/indent_style_parse_errors.snap @@ -10,7 +10,7 @@ flags/invalid ━━━━━━━━━━━━━━━━━━━━━━ × Failed to parse CLI arguments. Caused by: - Couldn't parse `invalid`: Unsupported value for this option + couldn't parse `invalid`: Unsupported value for this option diff --git a/crates/rome_cli/tests/snapshots/main_commands_format/line_width_parse_errors_negative.snap b/crates/rome_cli/tests/snapshots/main_commands_format/line_width_parse_errors_negative.snap index c38611d85b2..997a8a6d1fa 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_format/line_width_parse_errors_negative.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_format/line_width_parse_errors_negative.snap @@ -10,7 +10,7 @@ flags/invalid ━━━━━━━━━━━━━━━━━━━━━━ × Failed to parse CLI arguments. Caused by: - Couldn't parse `-1`: invalid digit found in string + couldn't parse `-1`: invalid digit found in string diff --git a/crates/rome_cli/tests/snapshots/main_commands_format/line_width_parse_errors_overflow.snap b/crates/rome_cli/tests/snapshots/main_commands_format/line_width_parse_errors_overflow.snap index c0a29ea1875..c0d47448889 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_format/line_width_parse_errors_overflow.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_format/line_width_parse_errors_overflow.snap @@ -10,7 +10,7 @@ flags/invalid ━━━━━━━━━━━━━━━━━━━━━━ × Failed to parse CLI arguments. Caused by: - Couldn't parse `321`: The line width exceeds the maximum value (320) + couldn't parse `321`: The line width exceeds the maximum value (320) diff --git a/crates/rome_cli/tests/snapshots/main_commands_format/quote_properties_parse_errors_letter_case.snap b/crates/rome_cli/tests/snapshots/main_commands_format/quote_properties_parse_errors_letter_case.snap index 6c2de74086c..13f14526371 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_format/quote_properties_parse_errors_letter_case.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_format/quote_properties_parse_errors_letter_case.snap @@ -10,7 +10,7 @@ flags/invalid ━━━━━━━━━━━━━━━━━━━━━━ × Failed to parse CLI arguments. Caused by: - Couldn't parse `As-needed`: Value not supported for QuoteProperties + couldn't parse `As-needed`: Value not supported for QuoteProperties diff --git a/crates/rome_cli/tests/snapshots/main_commands_format/trailing_comma_parse_errors.snap b/crates/rome_cli/tests/snapshots/main_commands_format/trailing_comma_parse_errors.snap index 007a41eafa4..b3dbcc91ea2 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_format/trailing_comma_parse_errors.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_format/trailing_comma_parse_errors.snap @@ -10,7 +10,7 @@ flags/invalid ━━━━━━━━━━━━━━━━━━━━━━ × Failed to parse CLI arguments. Caused by: - Couldn't parse `NONE`: Value not supported for TrailingComma + couldn't parse `NONE`: Value not supported for TrailingComma diff --git a/crates/rome_cli/tests/snapshots/main_commands_format/with_invalid_semicolons_option.snap b/crates/rome_cli/tests/snapshots/main_commands_format/with_invalid_semicolons_option.snap index aadba8e4936..2c2fa0c97fd 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_format/with_invalid_semicolons_option.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_format/with_invalid_semicolons_option.snap @@ -10,7 +10,7 @@ flags/invalid ━━━━━━━━━━━━━━━━━━━━━━ × Failed to parse CLI arguments. Caused by: - Couldn't parse `asneed`: Value not supported for Semicolons. Supported values are 'as-needed' and 'always'. + couldn't parse `asneed`: Value not supported for Semicolons. Supported values are 'as-needed' and 'always'. diff --git a/crates/rome_cli/tests/snapshots/main_commands_lint/check_help.snap b/crates/rome_cli/tests/snapshots/main_commands_lint/check_help.snap index ff3b1bff591..131a7a4bd93 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_lint/check_help.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_lint/check_help.snap @@ -14,7 +14,7 @@ The configuration that is contained inside the file `rome.json` --vcs-enabled= Whether Rome should integrate itself with the VCS client --vcs-use-ignore-file= Whether Rome should use the VCS ignore file. When [true], Rome will ignore the files specified in the ignore file. - --vcs-root=PATH The folder where Rome should check for VCS files. By default, Rome will + --vcs-root=PATH The folder where Rome should check for VCS files. By default, Rome will use the same folder where `rome.json` was found. If Rome can't find the configuration, it will attempt to use the current working directory. If no current working directory can't be found, Rome @@ -24,8 +24,8 @@ The configuration that is contained inside the file `rome.json` --files-ignore-unknown= Tells Rome to not emit diagnostics when handling files that doesn't know --indent-style= The indent style. - --indent-size=NUMBER The size of the indentation, 2 by default - --line-width=NUMBER What's the max width of a line. Defaults to 80. + --indent-size=NUMBER The size of the indentation, 2 by default + --line-width=NUMBER What's the max width of a line. Defaults to 80. --quote-style= The style for quotes. Defaults to double. --jsx-quote-style= The style for JSX quotes. Defaults to double. --quote-properties= When properties in objects are quoted. Defaults to asNeeded. @@ -37,31 +37,30 @@ The configuration that is contained inside the file `rome.json` Defaults to "always". Global options applied to all commands - --colors= Set the formatting mode for markup: "off" prints everything as plain - text, "force" forces the formatting of markup using ANSI even if the console + --colors= Set the formatting mode for markup: "off" prints everything as plain text, + "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible - --use-server Connect to a running instance of the Rome daemon server. - --verbose Print additional verbose advices on diagnostics - --config-path=PATH Set the filesystem path to the directory of the rome.json configuration + --use-server Connect to a running instance of the Rome daemon server. + --verbose Print additional verbose advices on diagnostics + --config-path=PATH Set the filesystem path to the directory of the rome.json configuration file --max-diagnostics=NUMBER Cap the amount of diagnostics displayed. - [default: 20] - --skip-errors Skip over files containing syntax errors instead of emitting an error - diagnostic. + [default: 20] + --skip-errors Skip over files containing syntax errors instead of emitting an error diagnostic. --no-errors-on-unmatched Silence errors that would be emitted in case no files were processed during the execution of the command. - --error-on-warnings Tell Rome to exit with an error code if some diagnostics emit warnings. - --json Reports information using the JSON format + --error-on-warnings Tell Rome to exit with an error code if some diagnostics emit warnings. + --json Reports information using the JSON format Available positional items: - PATH Single file, single path or list of paths + PATH Single file, single path or list of paths Available options: - --apply Apply safe fixes, formatting - --apply-unsafe Apply safe fixes and unsafe fixes, formatting and import sorting + --apply Apply safe fixes, formatting + --apply-unsafe Apply safe fixes and unsafe fixes, formatting and import sorting --stdin-file-path=PATH A file name with its extension to pass when reading from standard in, e.g. echo 'let a;' | rome lint --stdin-file-path=file.js" - -h, --help Prints help information + -h, --help Prints help information ``` diff --git a/crates/rome_cli/tests/snapshots/main_commands_lint/files_max_size_parse_error.snap b/crates/rome_cli/tests/snapshots/main_commands_lint/files_max_size_parse_error.snap index e0c939fae1e..e8c61b54dae 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_lint/files_max_size_parse_error.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_lint/files_max_size_parse_error.snap @@ -17,7 +17,7 @@ flags/invalid ━━━━━━━━━━━━━━━━━━━━━━ × Failed to parse CLI arguments. Caused by: - Couldn't parse `-1`: invalid digit found in string + couldn't parse `-1`: invalid digit found in string diff --git a/crates/rome_cli/tests/snapshots/main_commands_lsp_proxy/lsp_proxy_help.snap b/crates/rome_cli/tests/snapshots/main_commands_lsp_proxy/lsp_proxy_help.snap index b4699e2cb3d..77bd08ebb9b 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_lsp_proxy/lsp_proxy_help.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_lsp_proxy/lsp_proxy_help.snap @@ -11,24 +11,23 @@ Usage: lsp-proxy [--colors=] [--use-server] [--verbose] [--config-pat =NUMBER] [--skip-errors] [--no-errors-on-unmatched] [--error-on-warnings] Global options applied to all commands - --colors= Set the formatting mode for markup: "off" prints everything as plain - text, "force" forces the formatting of markup using ANSI even if the console + --colors= Set the formatting mode for markup: "off" prints everything as plain text, + "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible - --use-server Connect to a running instance of the Rome daemon server. - --verbose Print additional verbose advices on diagnostics - --config-path=PATH Set the filesystem path to the directory of the rome.json configuration + --use-server Connect to a running instance of the Rome daemon server. + --verbose Print additional verbose advices on diagnostics + --config-path=PATH Set the filesystem path to the directory of the rome.json configuration file --max-diagnostics=NUMBER Cap the amount of diagnostics displayed. - [default: 20] - --skip-errors Skip over files containing syntax errors instead of emitting an error - diagnostic. + [default: 20] + --skip-errors Skip over files containing syntax errors instead of emitting an error diagnostic. --no-errors-on-unmatched Silence errors that would be emitted in case no files were processed during the execution of the command. - --error-on-warnings Tell Rome to exit with an error code if some diagnostics emit warnings. - --json Reports information using the JSON format + --error-on-warnings Tell Rome to exit with an error code if some diagnostics emit warnings. + --json Reports information using the JSON format Available options: - -h, --help Prints help information + -h, --help Prints help information ``` diff --git a/crates/rome_cli/tests/snapshots/main_commands_migrate/migrate_help.snap b/crates/rome_cli/tests/snapshots/main_commands_migrate/migrate_help.snap index 7c081295aea..edfc6ea8445 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_migrate/migrate_help.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_migrate/migrate_help.snap @@ -10,25 +10,24 @@ It updates the configuration when there are breaking changes Usage: migrate [--write] Global options applied to all commands - --colors= Set the formatting mode for markup: "off" prints everything as plain - text, "force" forces the formatting of markup using ANSI even if the console + --colors= Set the formatting mode for markup: "off" prints everything as plain text, + "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible - --use-server Connect to a running instance of the Rome daemon server. - --verbose Print additional verbose advices on diagnostics - --config-path=PATH Set the filesystem path to the directory of the rome.json configuration + --use-server Connect to a running instance of the Rome daemon server. + --verbose Print additional verbose advices on diagnostics + --config-path=PATH Set the filesystem path to the directory of the rome.json configuration file --max-diagnostics=NUMBER Cap the amount of diagnostics displayed. - [default: 20] - --skip-errors Skip over files containing syntax errors instead of emitting an error - diagnostic. + [default: 20] + --skip-errors Skip over files containing syntax errors instead of emitting an error diagnostic. --no-errors-on-unmatched Silence errors that would be emitted in case no files were processed during the execution of the command. - --error-on-warnings Tell Rome to exit with an error code if some diagnostics emit warnings. - --json Reports information using the JSON format + --error-on-warnings Tell Rome to exit with an error code if some diagnostics emit warnings. + --json Reports information using the JSON format Available options: - --write Writes the new configuration file to disk - -h, --help Prints help information + --write Writes the new configuration file to disk + -h, --help Prints help information ``` diff --git a/website/src/pages/cli.md b/website/src/pages/cli.md new file mode 100644 index 00000000000..32690a62963 --- /dev/null +++ b/website/src/pages/cli.md @@ -0,0 +1,550 @@ +--- +title: CLI +emoji: ⌨️ +category: reference +description: Available commands and arguments in the Rome CLI. +--- + + + +# Command summary + + * [`rome`↴](#rome) + * [`rome version`↴](#rome-version) + * [`rome rage`↴](#rome-rage) + * [`rome start`↴](#rome-start) + * [`rome stop`↴](#rome-stop) + * [`rome check`↴](#rome-check) + * [`rome lint`↴](#rome-lint) + * [`rome format`↴](#rome-format) + * [`rome ci`↴](#rome-ci) + * [`rome init`↴](#rome-init) + * [`rome lsp-proxy`↴](#rome-lsp-proxy) + * [`rome migrate`↴](#rome-migrate) + +# rome + +Rome official CLI. Use it to check the health of your project or run it to check single files. + +**Usage**: **`rome`** _`COMMAND ...`_ + +**Available options:** +- **`-h`**, **`--help`** — + Prints help information +- **`-V`**, **`--version`** — + Prints version information + + + +**Available commands:** +- **`version`** — + Shows the Rome version information and quit +- **`rage`** — + Prints information for debugging +- **`start`** — + Start the Rome daemon server process +- **`stop`** — + Stop the Rome daemon server process +- **`check`** — + Run various checks on a set of files. +- **`lint`** — + Run various checks on a set of files. +- **`format`** — + Run the formatter on a set of files. +- **`ci`** — + Command to use in CI environments. Run various checks of a set of files. +- **`init`** — + Bootstraps a new rome project. Creates a configuration file with some defaults. +- **`lsp-proxy`** — + Acts as a server for the Language Server Protocol over stdin/stdout +- **`migrate`** — + It updates the configuration when there are breaking changes + + +# rome version + +Shows the Rome version information and quit + +**Usage**: **`rome`** **`version`** + +**Global options applied to all commands** +- **` --colors`**=_``_ — + Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible +- **` --use-server`** — + Connect to a running instance of the Rome daemon server. +- **` --verbose`** — + Print additional verbose advices on diagnostics +- **` --config-path`**=_`PATH`_ — + Set the filesystem path to the directory of the rome.json configuration file +- **` --max-diagnostics`**=_`NUMBER`_ — + Cap the amount of diagnostics displayed (default: 20) +- **` --skip-errors`** — + Skip over files containing syntax errors instead of emitting an error diagnostic. +- **` --no-errors-on-unmatched`** — + Silence errors that would be emitted in case no files were processed during the execution of the command. +- **` --json`** — + Reports information using the JSON format + + + +**Available options:** +- **`-h`**, **`--help`** — + Prints help information + + +# rome rage + +Prints information for debugging + +**Usage**: **`rome`** **`rage`** + +**Global options applied to all commands** +- **` --colors`**=_``_ — + Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible +- **` --use-server`** — + Connect to a running instance of the Rome daemon server. +- **` --verbose`** — + Print additional verbose advices on diagnostics +- **` --config-path`**=_`PATH`_ — + Set the filesystem path to the directory of the rome.json configuration file +- **` --max-diagnostics`**=_`NUMBER`_ — + Cap the amount of diagnostics displayed (default: 20) +- **` --skip-errors`** — + Skip over files containing syntax errors instead of emitting an error diagnostic. +- **` --no-errors-on-unmatched`** — + Silence errors that would be emitted in case no files were processed during the execution of the command. +- **` --json`** — + Reports information using the JSON format + + + +**Available options:** +- **`-h`**, **`--help`** — + Prints help information + + +# rome start + +Start the Rome daemon server process + +**Usage**: **`rome`** **`start`** + +**Available options:** +- **`-h`**, **`--help`** — + Prints help information + + +# rome stop + +Stop the Rome daemon server process + +**Usage**: **`rome`** **`stop`** + +**Available options:** +- **`-h`**, **`--help`** — + Prints help information + + +# rome check + +Run various checks on a set of files. + +**Usage**: **`rome`** **`check`** \[**`--apply`**\] \[**`--apply-unsafe`**\] \[_`PATH`_\]... + +**The configuration that is contained inside the file `rome.json`** +- **` --vcs-client-kind`**=_``_ — + The kind of client. +- **` --vcs-enabled`**=_``_ — + Whether Rome should integrate itself with the VCS client +- **` --vcs-use-ignore-file`**=_``_ — + Whether Rome should use the VCS ignore file. When [true], Rome will ignore the files specified in the ignore file. +- **` --vcs-root`**=_`PATH`_ — + The folder where Rome should check for VCS files. By default, Rome will use the same folder where `rome.json` was found. + + If Rome can't find the configuration, it will attempt to use the current working directory. If no current working directory can't be found, Rome won't use the VCS integration, and a diagnostic will be emitted +- **` --files-max-size`**=_`NUMBER`_ — + The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reason. Defaults to 1 MiB +- **` --files-ignore-unknown`**=_``_ — + Tells Rome to not emit diagnostics when handling files that doesn't know +- **` --indent-style`**=_``_ — + The indent style. + + ```shell rome format --indent-style=tab ``` +- **` --indent-size`**=_`NUMBER`_ — + The size of the indentation, 2 by default +- **` --line-width`**=_`NUMBER`_ — + What's the max width of a line. Defaults to 80. +- **` --quote-style`**=_``_ — + The style for quotes. Defaults to double. +- **` --jsx-quote-style`**=_``_ — + The style for JSX quotes. Defaults to double. +- **` --quote-properties`**=_``_ — + When properties in objects are quoted. Defaults to asNeeded. +- **` --trailing-comma`**=_``_ — + Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Defaults to "all". +- **` --semicolons`**=_``_ — + Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. + + + +**Global options applied to all commands** +- **` --colors`**=_``_ — + Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible +- **` --use-server`** — + Connect to a running instance of the Rome daemon server. +- **` --verbose`** — + Print additional verbose advices on diagnostics +- **` --config-path`**=_`PATH`_ — + Set the filesystem path to the directory of the rome.json configuration file +- **` --max-diagnostics`**=_`NUMBER`_ — + Cap the amount of diagnostics displayed (default: 20) +- **` --skip-errors`** — + Skip over files containing syntax errors instead of emitting an error diagnostic. +- **` --no-errors-on-unmatched`** — + Silence errors that would be emitted in case no files were processed during the execution of the command. +- **` --json`** — + Reports information using the JSON format + + + +**Available positional items:** +- _`PATH`_ — + Single file, single path or list of paths + + + +**Available options:** +- **` --apply`** — + Apply safe fixes, formatting +- **` --apply-unsafe`** — + Apply safe fixes and unsafe fixes, formatting and import sorting +- **` --formatter-enabled`**=_``_ — + Allow to enable or disable the formatter check. +- **` --linter-enabled`**=_``_ — + Allow to enable or disable the linter check. +- **` --organize-imports-enabled`**=_``_ — + Allow to enable or disable the organize imports. +- **` --stdin-file-path`**=_`PATH`_ — + A file name with its extension to pass when reading from standard in, e.g. echo 'let a;' | rome check --stdin-file-path=file.js" +- **`-h`**, **`--help`** — + Prints help information + + +# rome lint + +Run various checks on a set of files. + +**Usage**: **`rome`** **`lint`** \[**`--apply`**\] \[**`--apply-unsafe`**\] \[_`PATH`_\]... + +**The configuration that is contained inside the file `rome.json`** +- **` --vcs-client-kind`**=_``_ — + The kind of client. +- **` --vcs-enabled`**=_``_ — + Whether Rome should integrate itself with the VCS client +- **` --vcs-use-ignore-file`**=_``_ — + Whether Rome should use the VCS ignore file. When [true], Rome will ignore the files specified in the ignore file. +- **` --vcs-root`**=_`PATH`_ — + The folder where Rome should check for VCS files. By default, Rome will use the same folder where `rome.json` was found. + + If Rome can't find the configuration, it will attempt to use the current working directory. If no current working directory can't be found, Rome won't use the VCS integration, and a diagnostic will be emitted +- **` --files-max-size`**=_`NUMBER`_ — + The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reason. Defaults to 1 MiB +- **` --files-ignore-unknown`**=_``_ — + Tells Rome to not emit diagnostics when handling files that doesn't know +- **` --indent-style`**=_``_ — + The indent style. + + ```shell rome format --indent-style=tab ``` +- **` --indent-size`**=_`NUMBER`_ — + The size of the indentation, 2 by default +- **` --line-width`**=_`NUMBER`_ — + What's the max width of a line. Defaults to 80. +- **` --quote-style`**=_``_ — + The style for quotes. Defaults to double. +- **` --jsx-quote-style`**=_``_ — + The style for JSX quotes. Defaults to double. +- **` --quote-properties`**=_``_ — + When properties in objects are quoted. Defaults to asNeeded. +- **` --trailing-comma`**=_``_ — + Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Defaults to "all". +- **` --semicolons`**=_``_ — + Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. + + + +**Global options applied to all commands** +- **` --colors`**=_``_ — + Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible +- **` --use-server`** — + Connect to a running instance of the Rome daemon server. +- **` --verbose`** — + Print additional verbose advices on diagnostics +- **` --config-path`**=_`PATH`_ — + Set the filesystem path to the directory of the rome.json configuration file +- **` --max-diagnostics`**=_`NUMBER`_ — + Cap the amount of diagnostics displayed (default: 20) +- **` --skip-errors`** — + Skip over files containing syntax errors instead of emitting an error diagnostic. +- **` --no-errors-on-unmatched`** — + Silence errors that would be emitted in case no files were processed during the execution of the command. +- **` --json`** — + Reports information using the JSON format + + + +**Available positional items:** +- _`PATH`_ — + Single file, single path or list of paths + + + +**Available options:** +- **` --apply`** — + Apply safe fixes, formatting +- **` --apply-unsafe`** — + Apply safe fixes and unsafe fixes, formatting and import sorting +- **` --stdin-file-path`**=_`PATH`_ — + A file name with its extension to pass when reading from standard in, e.g. echo 'let a;' | rome lint --stdin-file-path=file.js" +- **`-h`**, **`--help`** — + Prints help information + + +# rome format + +Run the formatter on a set of files. + +**Usage**: **`rome`** **`format`** \[**`--write`**\] \[_`PATH`_\]... + +**Options applied to the formatter** +- **` --indent-style`**=_``_ — + The indent style. + + ```shell rome format --indent-style=tab ``` +- **` --indent-size`**=_`NUMBER`_ — + The size of the indentation, 2 by default +- **` --line-width`**=_`NUMBER`_ — + What's the max width of a line. Defaults to 80. + + + +**Set of properties to integrate Rome with a VCS software.** +- **` --vcs-client-kind`**=_``_ — + The kind of client. +- **` --vcs-enabled`**=_``_ — + Whether Rome should integrate itself with the VCS client +- **` --vcs-use-ignore-file`**=_``_ — + Whether Rome should use the VCS ignore file. When [true], Rome will ignore the files specified in the ignore file. +- **` --vcs-root`**=_`PATH`_ — + The folder where Rome should check for VCS files. By default, Rome will use the same folder where `rome.json` was found. + + If Rome can't find the configuration, it will attempt to use the current working directory. If no current working directory can't be found, Rome won't use the VCS integration, and a diagnostic will be emitted + + + +**The configuration of the filesystem** +- **` --files-max-size`**=_`NUMBER`_ — + The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reason. Defaults to 1 MiB +- **` --files-ignore-unknown`**=_``_ — + Tells Rome to not emit diagnostics when handling files that doesn't know + + + +**Global options applied to all commands** +- **` --colors`**=_``_ — + Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible +- **` --use-server`** — + Connect to a running instance of the Rome daemon server. +- **` --verbose`** — + Print additional verbose advices on diagnostics +- **` --config-path`**=_`PATH`_ — + Set the filesystem path to the directory of the rome.json configuration file +- **` --max-diagnostics`**=_`NUMBER`_ — + Cap the amount of diagnostics displayed (default: 20) +- **` --skip-errors`** — + Skip over files containing syntax errors instead of emitting an error diagnostic. +- **` --no-errors-on-unmatched`** — + Silence errors that would be emitted in case no files were processed during the execution of the command. +- **` --json`** — + Reports information using the JSON format + + + +**Available positional items:** +- _`PATH`_ — + Single file, single path or list of paths. + + + +**Available options:** +- **` --quote-style`**=_``_ — + The style for quotes. Defaults to double. +- **` --jsx-quote-style`**=_``_ — + The style for JSX quotes. Defaults to double. +- **` --quote-properties`**=_``_ — + When properties in objects are quoted. Defaults to asNeeded. +- **` --trailing-comma`**=_``_ — + Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Defaults to "all". +- **` --semicolons`**=_``_ — + Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. +- **` --stdin-file-path`**=_`PATH`_ — + A file name with its extension to pass when reading from standard in, e.g. echo 'let a;' | rome format --stdin-file-path=file.js". +- **` --write`** — + Writes formatted files to file system. +- **`-h`**, **`--help`** — + Prints help information + + +# rome ci + +Command to use in CI environments. Run various checks of a set of files. + +**Usage**: **`rome`** **`ci`** \[**`--formatter-enabled`**=_``_\] \[**`--linter-enabled`**=_``_\] \[**`--organize-imports-enabled`**=_``_\] \[_`PATH`_\]... + +**The configuration that is contained inside the file `rome.json`** +- **` --vcs-client-kind`**=_``_ — + The kind of client. +- **` --vcs-enabled`**=_``_ — + Whether Rome should integrate itself with the VCS client +- **` --vcs-use-ignore-file`**=_``_ — + Whether Rome should use the VCS ignore file. When [true], Rome will ignore the files specified in the ignore file. +- **` --vcs-root`**=_`PATH`_ — + The folder where Rome should check for VCS files. By default, Rome will use the same folder where `rome.json` was found. + + If Rome can't find the configuration, it will attempt to use the current working directory. If no current working directory can't be found, Rome won't use the VCS integration, and a diagnostic will be emitted +- **` --files-max-size`**=_`NUMBER`_ — + The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reason. Defaults to 1 MiB +- **` --files-ignore-unknown`**=_``_ — + Tells Rome to not emit diagnostics when handling files that doesn't know +- **` --indent-style`**=_``_ — + The indent style. + + ```shell rome format --indent-style=tab ``` +- **` --indent-size`**=_`NUMBER`_ — + The size of the indentation, 2 by default +- **` --line-width`**=_`NUMBER`_ — + What's the max width of a line. Defaults to 80. +- **` --quote-style`**=_``_ — + The style for quotes. Defaults to double. +- **` --jsx-quote-style`**=_``_ — + The style for JSX quotes. Defaults to double. +- **` --quote-properties`**=_``_ — + When properties in objects are quoted. Defaults to asNeeded. +- **` --trailing-comma`**=_``_ — + Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Defaults to "all". +- **` --semicolons`**=_``_ — + Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. + + + +**Global options applied to all commands** +- **` --colors`**=_``_ — + Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible +- **` --use-server`** — + Connect to a running instance of the Rome daemon server. +- **` --verbose`** — + Print additional verbose advices on diagnostics +- **` --config-path`**=_`PATH`_ — + Set the filesystem path to the directory of the rome.json configuration file +- **` --max-diagnostics`**=_`NUMBER`_ — + Cap the amount of diagnostics displayed (default: 20) +- **` --skip-errors`** — + Skip over files containing syntax errors instead of emitting an error diagnostic. +- **` --no-errors-on-unmatched`** — + Silence errors that would be emitted in case no files were processed during the execution of the command. +- **` --json`** — + Reports information using the JSON format + + + +**Available positional items:** +- _`PATH`_ — + Single file, single path or list of paths + + + +**Available options:** +- **` --formatter-enabled`**=_``_ — + Allow to enable or disable the formatter check. +- **` --linter-enabled`**=_``_ — + Allow to enable or disable the linter check. +- **` --organize-imports-enabled`**=_``_ — + Allow to enable or disable the organize imports. +- **`-h`**, **`--help`** — + Prints help information + + +# rome init + +Bootstraps a new rome project. Creates a configuration file with some defaults. + +**Usage**: **`rome`** **`init`** + +**Available options:** +- **`-h`**, **`--help`** — + Prints help information + + +# rome lsp-proxy + +Acts as a server for the Language Server Protocol over stdin/stdout + +**Usage**: **`rome`** **`lsp-proxy`** \[**`--colors`**=_``_\] \[**`--use-server`**\] \[**`--verbose`**\] \[**`--config-path`**=_`PATH`_\] \[**`--max-diagnostics`**=_`NUMBER`_\] \[**`--skip-errors`**\] \[**`--no-errors-on-unmatched`**\] + +**Global options applied to all commands** +- **` --colors`**=_``_ — + Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible +- **` --use-server`** — + Connect to a running instance of the Rome daemon server. +- **` --verbose`** — + Print additional verbose advices on diagnostics +- **` --config-path`**=_`PATH`_ — + Set the filesystem path to the directory of the rome.json configuration file +- **` --max-diagnostics`**=_`NUMBER`_ — + Cap the amount of diagnostics displayed (default: 20) +- **` --skip-errors`** — + Skip over files containing syntax errors instead of emitting an error diagnostic. +- **` --no-errors-on-unmatched`** — + Silence errors that would be emitted in case no files were processed during the execution of the command. +- **` --json`** — + Reports information using the JSON format + + + +**Available options:** +- **`-h`**, **`--help`** — + Prints help information + + +# rome migrate + +It updates the configuration when there are breaking changes + +**Usage**: **`rome`** **`migrate`** \[**`--write`**\] + +**Global options applied to all commands** +- **` --colors`**=_``_ — + Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible +- **` --use-server`** — + Connect to a running instance of the Rome daemon server. +- **` --verbose`** — + Print additional verbose advices on diagnostics +- **` --config-path`**=_`PATH`_ — + Set the filesystem path to the directory of the rome.json configuration file +- **` --max-diagnostics`**=_`NUMBER`_ — + Cap the amount of diagnostics displayed (default: 20) +- **` --skip-errors`** — + Skip over files containing syntax errors instead of emitting an error diagnostic. +- **` --no-errors-on-unmatched`** — + Silence errors that would be emitted in case no files were processed during the execution of the command. +- **` --json`** — + Reports information using the JSON format + + + +**Available options:** +- **` --write`** — + Writes the new configuration file to disk +- **`-h`**, **`--help`** — + Prints help information + + diff --git a/website/src/pages/cli.mdx b/website/src/pages/cli.mdx index 1a925994617..86aad964888 100644 --- a/website/src/pages/cli.mdx +++ b/website/src/pages/cli.mdx @@ -5,112 +5,578 @@ category: reference description: Available commands and arguments in the Rome CLI. --- -# CLI -## Commands -### `rome init` +# Command summary + + * [`rome`↴](#rome) + * [`rome version`↴](#rome-version) + * [`rome rage`↴](#rome-rage) + * [`rome start`↴](#rome-start) + * [`rome stop`↴](#rome-stop) + * [`rome check`↴](#rome-check) + * [`rome lint`↴](#rome-lint) + * [`rome format`↴](#rome-format) + * [`rome ci`↴](#rome-ci) + * [`rome init`↴](#rome-init) + * [`rome lsp-proxy`↴](#rome-lsp-proxy) + * [`rome migrate`↴](#rome-migrate) + +# rome + +Rome official CLI. Use it to check the health of your project or run it to check single files. + +**Usage**: **`rome`** _`COMMAND ...`_ + +**Available options:** +- **`-h`**, **`--help`** — + Prints help information +- **`-V`**, **`--version`** — + Prints version information + + + +**Available commands:** +- **`version`** — + Shows the Rome version information and quit +- **`rage`** — + Prints information for debugging +- **`start`** — + Start the Rome daemon server process +- **`stop`** — + Stop the Rome daemon server process +- **`check`** — + Run various checks on a set of files. +- **`lint`** — + Run various checks on a set of files. +- **`format`** — + Run the formatter on a set of files. +- **`ci`** — + Command to use in CI environments. Run various checks of a set of files. +- **`init`** — + Bootstraps a new rome project. Creates a configuration file with some defaults. +- **`lsp-proxy`** — + Acts as a server for the Language Server Protocol over stdin/stdout +- **`migrate`** — + It updates the configuration when there are breaking changes -Help you to set up Rome for a new project by guiding you through the creation of a new `rome.json` [configuration](/configuration) file. -The command fails if the project already has a `rome.json` configuration file. +# rome version -### `rome version` +Shows the Rome version information and quit -Print the version of the CLI and whether there's a server (daemon) connected +**Usage**: **`rome`** **`version`** -### `rome rage` - -Print information for debugging purpose - -### `rome lsp-proxy` - -It starts a server for the LSP protocol, which communicates over `stdin` and `stdout`. - -This command is useful to interact with the Rome server when developing editors/IDEs. - -### `rome format` +**Global options applied to all commands** +- **` --colors`**=_``_ — + Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible +- **` --use-server`** — + Connect to a running instance of the Rome daemon server. +- **` --verbose`** — + Print additional verbose advices on diagnostics +- **` --config-path`**=_`PATH`_ — + Set the filesystem path to the directory of the rome.json configuration file +- **` --max-diagnostics`**=_`NUMBER`_ — + Cap the amount of diagnostics displayed. + + [default: 20] +- **` --skip-errors`** — + Skip over files containing syntax errors instead of emitting an error diagnostic. +- **` --no-errors-on-unmatched`** — + Silence errors that would be emitted in case no files were processed during the execution of the command. +- **` --error-on-warnings`** — + Tell Rome to exit with an error code if some diagnostics emit warnings. +- **` --json`** — + Reports information using the JSON format + + + +**Available options:** +- **`-h`**, **`--help`** — + Prints help information + + +# rome rage + +Prints information for debugging + +**Usage**: **`rome`** **`rage`** + +**Global options applied to all commands** +- **` --colors`**=_``_ — + Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible +- **` --use-server`** — + Connect to a running instance of the Rome daemon server. +- **` --verbose`** — + Print additional verbose advices on diagnostics +- **` --config-path`**=_`PATH`_ — + Set the filesystem path to the directory of the rome.json configuration file +- **` --max-diagnostics`**=_`NUMBER`_ — + Cap the amount of diagnostics displayed. + + [default: 20] +- **` --skip-errors`** — + Skip over files containing syntax errors instead of emitting an error diagnostic. +- **` --no-errors-on-unmatched`** — + Silence errors that would be emitted in case no files were processed during the execution of the command. +- **` --error-on-warnings`** — + Tell Rome to exit with an error code if some diagnostics emit warnings. +- **` --json`** — + Reports information using the JSON format + + + +**Available options:** +- **`-h`**, **`--help`** — + Prints help information + + +# rome start + +Start the Rome daemon server process + +**Usage**: **`rome`** **`start`** + +**Available options:** +- **`-h`**, **`--help`** — + Prints help information + + +# rome stop + +Stop the Rome daemon server process + +**Usage**: **`rome`** **`stop`** + +**Available options:** +- **`-h`**, **`--help`** — + Prints help information + + +# rome check + +Run various checks on a set of files. + +**Usage**: **`rome`** **`check`** \[**`--apply`**\] \[**`--apply-unsafe`**\] \[_`PATH`_\]... + +**The configuration that is contained inside the file `rome.json`** +- **` --vcs-client-kind`**=_``_ — + The kind of client. +- **` --vcs-enabled`**=_``_ — + Whether Rome should integrate itself with the VCS client +- **` --vcs-use-ignore-file`**=_``_ — + Whether Rome should use the VCS ignore file. When [true], Rome will ignore the files specified in the ignore file. +- **` --vcs-root`**=_`PATH`_ — + The folder where Rome should check for VCS files. By default, Rome will use the same folder where `rome.json` was found. + + If Rome can't find the configuration, it will attempt to use the current working directory. If no current working directory can't be found, Rome won't use the VCS integration, and a diagnostic will be emitted +- **` --files-max-size`**=_`NUMBER`_ — + The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reason. Defaults to 1 MiB +- **` --files-ignore-unknown`**=_``_ — + Tells Rome to not emit diagnostics when handling files that doesn't know +- **` --indent-style`**=_``_ — + The indent style. +- **` --indent-size`**=_`NUMBER`_ — + The size of the indentation, 2 by default +- **` --line-width`**=_`NUMBER`_ — + What's the max width of a line. Defaults to 80. +- **` --quote-style`**=_``_ — + The style for quotes. Defaults to double. +- **` --jsx-quote-style`**=_``_ — + The style for JSX quotes. Defaults to double. +- **` --quote-properties`**=_``_ — + When properties in objects are quoted. Defaults to asNeeded. +- **` --trailing-comma`**=_``_ — + Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Defaults to "all". +- **` --semicolons`**=_``_ — + Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. +- **` --arrow-parentheses`**=_``_ — + Whether to add non-necessary parentheses to arrow functions. Defaults to "always". + + + +**Global options applied to all commands** +- **` --colors`**=_``_ — + Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible +- **` --use-server`** — + Connect to a running instance of the Rome daemon server. +- **` --verbose`** — + Print additional verbose advices on diagnostics +- **` --config-path`**=_`PATH`_ — + Set the filesystem path to the directory of the rome.json configuration file +- **` --max-diagnostics`**=_`NUMBER`_ — + Cap the amount of diagnostics displayed. + + [default: 20] +- **` --skip-errors`** — + Skip over files containing syntax errors instead of emitting an error diagnostic. +- **` --no-errors-on-unmatched`** — + Silence errors that would be emitted in case no files were processed during the execution of the command. +- **` --error-on-warnings`** — + Tell Rome to exit with an error code if some diagnostics emit warnings. +- **` --json`** — + Reports information using the JSON format + + + +**Available positional items:** +- _`PATH`_ — + Single file, single path or list of paths + + + +**Available options:** +- **` --apply`** — + Apply safe fixes, formatting +- **` --apply-unsafe`** — + Apply safe fixes and unsafe fixes, formatting and import sorting +- **` --formatter-enabled`**=_``_ — + Allow to enable or disable the formatter check. +- **` --linter-enabled`**=_``_ — + Allow to enable or disable the linter check. +- **` --organize-imports-enabled`**=_``_ — + Allow to enable or disable the organize imports. +- **` --stdin-file-path`**=_`PATH`_ — + A file name with its extension to pass when reading from standard in, e.g. echo 'let a;' | rome check --stdin-file-path=file.js" +- **`-h`**, **`--help`** — + Prints help information + + +# rome lint + +Run various checks on a set of files. + +**Usage**: **`rome`** **`lint`** \[**`--apply`**\] \[**`--apply-unsafe`**\] \[_`PATH`_\]... + +**The configuration that is contained inside the file `rome.json`** +- **` --vcs-client-kind`**=_``_ — + The kind of client. +- **` --vcs-enabled`**=_``_ — + Whether Rome should integrate itself with the VCS client +- **` --vcs-use-ignore-file`**=_``_ — + Whether Rome should use the VCS ignore file. When [true], Rome will ignore the files specified in the ignore file. +- **` --vcs-root`**=_`PATH`_ — + The folder where Rome should check for VCS files. By default, Rome will use the same folder where `rome.json` was found. + + If Rome can't find the configuration, it will attempt to use the current working directory. If no current working directory can't be found, Rome won't use the VCS integration, and a diagnostic will be emitted +- **` --files-max-size`**=_`NUMBER`_ — + The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reason. Defaults to 1 MiB +- **` --files-ignore-unknown`**=_``_ — + Tells Rome to not emit diagnostics when handling files that doesn't know +- **` --indent-style`**=_``_ — + The indent style. +- **` --indent-size`**=_`NUMBER`_ — + The size of the indentation, 2 by default +- **` --line-width`**=_`NUMBER`_ — + What's the max width of a line. Defaults to 80. +- **` --quote-style`**=_``_ — + The style for quotes. Defaults to double. +- **` --jsx-quote-style`**=_``_ — + The style for JSX quotes. Defaults to double. +- **` --quote-properties`**=_``_ — + When properties in objects are quoted. Defaults to asNeeded. +- **` --trailing-comma`**=_``_ — + Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Defaults to "all". +- **` --semicolons`**=_``_ — + Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. +- **` --arrow-parentheses`**=_``_ — + Whether to add non-necessary parentheses to arrow functions. Defaults to "always". + + + +**Global options applied to all commands** +- **` --colors`**=_``_ — + Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible +- **` --use-server`** — + Connect to a running instance of the Rome daemon server. +- **` --verbose`** — + Print additional verbose advices on diagnostics +- **` --config-path`**=_`PATH`_ — + Set the filesystem path to the directory of the rome.json configuration file +- **` --max-diagnostics`**=_`NUMBER`_ — + Cap the amount of diagnostics displayed. + + [default: 20] +- **` --skip-errors`** — + Skip over files containing syntax errors instead of emitting an error diagnostic. +- **` --no-errors-on-unmatched`** — + Silence errors that would be emitted in case no files were processed during the execution of the command. +- **` --error-on-warnings`** — + Tell Rome to exit with an error code if some diagnostics emit warnings. +- **` --json`** — + Reports information using the JSON format + + + +**Available positional items:** +- _`PATH`_ — + Single file, single path or list of paths + + + +**Available options:** +- **` --apply`** — + Apply safe fixes, formatting +- **` --apply-unsafe`** — + Apply safe fixes and unsafe fixes, formatting and import sorting +- **` --stdin-file-path`**=_`PATH`_ — + A file name with its extension to pass when reading from standard in, e.g. echo 'let a;' | rome lint --stdin-file-path=file.js" +- **`-h`**, **`--help`** — + Prints help information + + +# rome format Run the formatter on a set of files. -### `rome check` - -Run the linter on a set of files and reports errors and warnings to the console. - -### `rome ci` - -Run the linter and verifies the formatting of a set of files. It reports errors to the console. If any errors are found the process exits with a code of `1`. - -This command is intended to be used in CI workflows. - -### `rome start` - -Start the Rome [daemon](/internals/architecture#daemon) server - -### `rome stop` - -Stop the Rome [daemon](/internals/architecture#deamon) server - -### `rome migrate` - -Automatically updates the configuration file to use the latest version, in case there were breaking changes among versions. - -## Global Options - -### `--colors` - -Set the formatting mode for markup: `off` prints everything as plain text, -`force` forces the formatting of markup using ANSI even if the console output -is determined to be incompatible - -> Default: `force` - -### `--use-server` - -Connect to a running instance of the Rome daemon server - -##### `--files-max-size` - -The maximum allowed size for source code files in bytes. - -> Default: 1024*1024 bytes (1 MB) - -### `--config-path` - -Tell Rome in which path to find the configuration file `rome.json`. - -> **Warning**: when passing `--config-path`, the auto discovery of the `rome.json` file is disabled. - -If Rome doesn't find a `rome.json`, it will abort the operation and exit with and error code. - -### `--vcs-enabled` - -Whether Rome should integrate itself with the VCS client. - -### `--vcs-client-kind` - -The kind of VCS client rome should support. - -Options available: -- `git` - -### `--vcs-use-ignore-file` - -Whether Rome should use the VCS ignore file. When [true], Rome will ignore the files specified in the ignore file. - -### `--vcs-root` - -The folder where Rome should check for VCS files. By default, Rome will use the same -folder where `rome.json` was found. - -If Rome can't fine the configuration, it will attempt to use the current working directory. -If no current working directory can't be found, Rome won't use the VCS integration. +**Usage**: **`rome`** **`format`** \[**`--write`**\] \[_`PATH`_\]... + +**Options applied to the formatter** +- **` --indent-style`**=_``_ — + The indent style. +- **` --indent-size`**=_`NUMBER`_ — + The size of the indentation, 2 by default +- **` --line-width`**=_`NUMBER`_ — + What's the max width of a line. Defaults to 80. + + + +**Set of properties to integrate Rome with a VCS software.** +- **` --vcs-client-kind`**=_``_ — + The kind of client. +- **` --vcs-enabled`**=_``_ — + Whether Rome should integrate itself with the VCS client +- **` --vcs-use-ignore-file`**=_``_ — + Whether Rome should use the VCS ignore file. When [true], Rome will ignore the files specified in the ignore file. +- **` --vcs-root`**=_`PATH`_ — + The folder where Rome should check for VCS files. By default, Rome will use the same folder where `rome.json` was found. + + If Rome can't find the configuration, it will attempt to use the current working directory. If no current working directory can't be found, Rome won't use the VCS integration, and a diagnostic will be emitted + + + +**The configuration of the filesystem** +- **` --files-max-size`**=_`NUMBER`_ — + The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reason. Defaults to 1 MiB +- **` --files-ignore-unknown`**=_``_ — + Tells Rome to not emit diagnostics when handling files that doesn't know + + + +**Global options applied to all commands** +- **` --colors`**=_``_ — + Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible +- **` --use-server`** — + Connect to a running instance of the Rome daemon server. +- **` --verbose`** — + Print additional verbose advices on diagnostics +- **` --config-path`**=_`PATH`_ — + Set the filesystem path to the directory of the rome.json configuration file +- **` --max-diagnostics`**=_`NUMBER`_ — + Cap the amount of diagnostics displayed. + + [default: 20] +- **` --skip-errors`** — + Skip over files containing syntax errors instead of emitting an error diagnostic. +- **` --no-errors-on-unmatched`** — + Silence errors that would be emitted in case no files were processed during the execution of the command. +- **` --error-on-warnings`** — + Tell Rome to exit with an error code if some diagnostics emit warnings. +- **` --json`** — + Reports information using the JSON format + + + +**Available positional items:** +- _`PATH`_ — + Single file, single path or list of paths. + + + +**Available options:** +- **` --quote-style`**=_``_ — + The style for quotes. Defaults to double. +- **` --jsx-quote-style`**=_``_ — + The style for JSX quotes. Defaults to double. +- **` --quote-properties`**=_``_ — + When properties in objects are quoted. Defaults to asNeeded. +- **` --trailing-comma`**=_``_ — + Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Defaults to "all". +- **` --semicolons`**=_``_ — + Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. +- **` --arrow-parentheses`**=_``_ — + Whether to add non-necessary parentheses to arrow functions. Defaults to "always". +- **` --stdin-file-path`**=_`PATH`_ — + A file name with its extension to pass when reading from standard in, e.g. echo 'let a;' | rome format --stdin-file-path=file.js". +- **` --write`** — + Writes formatted files to file system. +- **`-h`**, **`--help`** — + Prints help information + + +# rome ci + +Command to use in CI environments. Run various checks of a set of files. + +**Usage**: **`rome`** **`ci`** \[**`--formatter-enabled`**=_``_\] \[**`--linter-enabled`**=_``_\] \[**`--organize-imports-enabled`**=_``_\] \[_`PATH`_\]... + +**The configuration that is contained inside the file `rome.json`** +- **` --vcs-client-kind`**=_``_ — + The kind of client. +- **` --vcs-enabled`**=_``_ — + Whether Rome should integrate itself with the VCS client +- **` --vcs-use-ignore-file`**=_``_ — + Whether Rome should use the VCS ignore file. When [true], Rome will ignore the files specified in the ignore file. +- **` --vcs-root`**=_`PATH`_ — + The folder where Rome should check for VCS files. By default, Rome will use the same folder where `rome.json` was found. + + If Rome can't find the configuration, it will attempt to use the current working directory. If no current working directory can't be found, Rome won't use the VCS integration, and a diagnostic will be emitted +- **` --files-max-size`**=_`NUMBER`_ — + The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reason. Defaults to 1 MiB +- **` --files-ignore-unknown`**=_``_ — + Tells Rome to not emit diagnostics when handling files that doesn't know +- **` --indent-style`**=_``_ — + The indent style. +- **` --indent-size`**=_`NUMBER`_ — + The size of the indentation, 2 by default +- **` --line-width`**=_`NUMBER`_ — + What's the max width of a line. Defaults to 80. +- **` --quote-style`**=_``_ — + The style for quotes. Defaults to double. +- **` --jsx-quote-style`**=_``_ — + The style for JSX quotes. Defaults to double. +- **` --quote-properties`**=_``_ — + When properties in objects are quoted. Defaults to asNeeded. +- **` --trailing-comma`**=_``_ — + Print trailing commas wherever possible in multi-line comma-separated syntactic structures. Defaults to "all". +- **` --semicolons`**=_``_ — + Whether the formatter prints semicolons for all statements or only in for statements where it is necessary because of ASI. +- **` --arrow-parentheses`**=_``_ — + Whether to add non-necessary parentheses to arrow functions. Defaults to "always". + + + +**Global options applied to all commands** +- **` --colors`**=_``_ — + Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible +- **` --use-server`** — + Connect to a running instance of the Rome daemon server. +- **` --verbose`** — + Print additional verbose advices on diagnostics +- **` --config-path`**=_`PATH`_ — + Set the filesystem path to the directory of the rome.json configuration file +- **` --max-diagnostics`**=_`NUMBER`_ — + Cap the amount of diagnostics displayed. + + [default: 20] +- **` --skip-errors`** — + Skip over files containing syntax errors instead of emitting an error diagnostic. +- **` --no-errors-on-unmatched`** — + Silence errors that would be emitted in case no files were processed during the execution of the command. +- **` --error-on-warnings`** — + Tell Rome to exit with an error code if some diagnostics emit warnings. +- **` --json`** — + Reports information using the JSON format + + + +**Available positional items:** +- _`PATH`_ — + Single file, single path or list of paths + + + +**Available options:** +- **` --formatter-enabled`**=_``_ — + Allow to enable or disable the formatter check. +- **` --linter-enabled`**=_``_ — + Allow to enable or disable the linter check. +- **` --organize-imports-enabled`**=_``_ — + Allow to enable or disable the organize imports. +- **`-h`**, **`--help`** — + Prints help information + + +# rome init + +Bootstraps a new rome project. Creates a configuration file with some defaults. + +**Usage**: **`rome`** **`init`** + +**Available options:** +- **`-h`**, **`--help`** — + Prints help information + + +# rome lsp-proxy + +Acts as a server for the Language Server Protocol over stdin/stdout + +**Usage**: **`rome`** **`lsp-proxy`** \[**`--colors`**=_``_\] \[**`--use-server`**\] \[**`--verbose`**\] \[**`--config-path`**=_`PATH`_\] \[**`--max-diagnostics`**=_`NUMBER`_\] \[**`--skip-errors`**\] \[**`--no-errors-on-unmatched`**\] \[**`--error-on-warnings`**\] + +**Global options applied to all commands** +- **` --colors`**=_``_ — + Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible +- **` --use-server`** — + Connect to a running instance of the Rome daemon server. +- **` --verbose`** — + Print additional verbose advices on diagnostics +- **` --config-path`**=_`PATH`_ — + Set the filesystem path to the directory of the rome.json configuration file +- **` --max-diagnostics`**=_`NUMBER`_ — + Cap the amount of diagnostics displayed. + + [default: 20] +- **` --skip-errors`** — + Skip over files containing syntax errors instead of emitting an error diagnostic. +- **` --no-errors-on-unmatched`** — + Silence errors that would be emitted in case no files were processed during the execution of the command. +- **` --error-on-warnings`** — + Tell Rome to exit with an error code if some diagnostics emit warnings. +- **` --json`** — + Reports information using the JSON format + + + +**Available options:** +- **`-h`**, **`--help`** — + Prints help information + + +# rome migrate + +It updates the configuration when there are breaking changes + +**Usage**: **`rome`** **`migrate`** \[**`--write`**\] + +**Global options applied to all commands** +- **` --colors`**=_``_ — + Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible +- **` --use-server`** — + Connect to a running instance of the Rome daemon server. +- **` --verbose`** — + Print additional verbose advices on diagnostics +- **` --config-path`**=_`PATH`_ — + Set the filesystem path to the directory of the rome.json configuration file +- **` --max-diagnostics`**=_`NUMBER`_ — + Cap the amount of diagnostics displayed. + + [default: 20] +- **` --skip-errors`** — + Skip over files containing syntax errors instead of emitting an error diagnostic. +- **` --no-errors-on-unmatched`** — + Silence errors that would be emitted in case no files were processed during the execution of the command. +- **` --error-on-warnings`** — + Tell Rome to exit with an error code if some diagnostics emit warnings. +- **` --json`** — + Reports information using the JSON format -### `--version` -Print the Rome version and exits. +**Available options:** +- **` --write`** — + Writes the new configuration file to disk +- **`-h`**, **`--help`** — + Prints help information -### `--help` -Print the help message and exits. diff --git a/xtask/codegen/Cargo.toml b/xtask/codegen/Cargo.toml index de53472755c..8bc689875e4 100644 --- a/xtask/codegen/Cargo.toml +++ b/xtask/codegen/Cargo.toml @@ -20,6 +20,7 @@ pulldown-cmark = { version = "0.9", default-features = false, optional = true } fs_extra = "1.3.0" rome_rowan = { path = "../../crates/rome_rowan", optional = true } +rome_cli = { workspace = true, optional = true } rome_analyze = { path = "../../crates/rome_analyze", optional = true } rome_js_analyze = { path = "../../crates/rome_js_analyze", optional = true } rome_json_analyze = { workspace = true, optional = true } @@ -46,7 +47,7 @@ configuration = [ "rome_json_syntax", "pulldown-cmark", ] -website = ["rome_service"] +website = ["rome_service", "rome_cli/docgen"] schema = [ "schemars", "serde_json", diff --git a/xtask/codegen/src/generate_website.rs b/xtask/codegen/src/generate_website.rs index 162d1db1a30..0cd608bc26c 100644 --- a/xtask/codegen/src/generate_website.rs +++ b/xtask/codegen/src/generate_website.rs @@ -1,3 +1,4 @@ +use rome_cli::rome_command; use rome_service::VERSION; use std::fs; use xtask::{project_root, Result}; @@ -10,6 +11,14 @@ description: Notes about the Rome's VSCode extension --- "#; +const CLI_FRONTMATTER: &str = r#"--- +title: CLI +emoji: ⌨️ +category: reference +description: Available commands and arguments in the Rome CLI. +--- +"#; + const SCHEMA_TEMPLATE: &str = r#"// Run `ROME_VERSION= cargo codegen-website // to generate a new schema import {readFileSync} from "fs"; @@ -33,6 +42,12 @@ pub(crate) fn generate_files() -> Result<()> { fs::remove_file(project_root().join("website/src/pages/vscode.mdx")).ok(); let page = format!("{FRONTMATTER}{readme}"); fs::write(project_root().join("website/src/pages/vscode.mdx"), page)?; + let parser = rome_command(); + let markdown = parser.render_markdown("rome"); + fs::write( + project_root().join("website/src/pages/cli.mdx"), + format!("{CLI_FRONTMATTER}{markdown}"), + )?; if VERSION != "0.0.0" { let schema_root_folder = project_root().join("website/src/pages/schemas");