diff --git a/cli/src/commands/fix.rs b/cli/src/commands/fix.rs index b8a9bc44f..19113b0d2 100644 --- a/cli/src/commands/fix.rs +++ b/cli/src/commands/fix.rs @@ -83,8 +83,9 @@ use crate::ui::Ui; /// /// For example, the following configuration defines how two code formatters /// (`clang-format` and `black`) will apply to three different file extensions -/// (.cc, .h, and .py): +/// (`.cc`, `.h`, and `.py`): /// +/// ```toml /// [fix.tools.clang-format] /// command = ["/usr/bin/clang-format", "--assume-filename=$path"] /// patterns = ["glob:'**/*.cc'", @@ -93,6 +94,7 @@ use crate::ui::Ui; /// [fix.tools.black] /// command = ["/usr/bin/black", "-", "--stdin-filename=$path"] /// patterns = ["glob:'**/*.py'"] +/// ``` /// /// Execution order of tools that affect the same file is deterministic, but /// currently unspecified, and may change between releases. If two tools affect @@ -104,8 +106,10 @@ use crate::ui::Ui; /// example, the following configuration would apply the Rust formatter to all /// changed files (whether they are Rust files or not): /// +/// ```toml /// [fix] /// tool-command = ["rustfmt", "--emit", "stdout"] +/// ``` /// /// The tool defined by `tool-command` acts as if it was the first entry in /// `fix.tools`, and uses `pattern = "all()"``. Support for `tool-command` diff --git a/cli/tests/cli-reference@.md.snap b/cli/tests/cli-reference@.md.snap index d749fead6..2304cb8c3 100644 --- a/cli/tests/cli-reference@.md.snap +++ b/cli/tests/cli-reference@.md.snap @@ -809,8 +809,9 @@ the values have the following properties: For example, the following configuration defines how two code formatters (`clang-format` and `black`) will apply to three different file extensions -(.cc, .h, and .py): +(`.cc`, `.h`, and `.py`): +```toml [fix.tools.clang-format] command = ["/usr/bin/clang-format", "--assume-filename=$path"] patterns = ["glob:'**/*.cc'", @@ -819,6 +820,7 @@ patterns = ["glob:'**/*.cc'", [fix.tools.black] command = ["/usr/bin/black", "-", "--stdin-filename=$path"] patterns = ["glob:'**/*.py'"] +``` Execution order of tools that affect the same file is deterministic, but currently unspecified, and may change between releases. If two tools affect @@ -830,8 +832,10 @@ command that will affect all changed files in the specified revisions. For example, the following configuration would apply the Rust formatter to all changed files (whether they are Rust files or not): +```toml [fix] tool-command = ["rustfmt", "--emit", "stdout"] +``` The tool defined by `tool-command` acts as if it was the first entry in `fix.tools`, and uses `pattern = "all()"``. Support for `tool-command`