From 2224fd361682e58ecb3869481ec965cca4f2060a Mon Sep 17 00:00:00 2001 From: Matt Kulukundis Date: Thu, 22 Aug 2024 15:13:29 -0400 Subject: [PATCH] docs: improve md format for `jj fix` --- cli/src/commands/fix.rs | 6 +++++- cli/tests/cli-reference@.md.snap | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cli/src/commands/fix.rs b/cli/src/commands/fix.rs index b8a9bc44f9..19113b0d29 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 d749fead6f..2304cb8c3a 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`