Skip to content

Commit

Permalink
docs: improve md format for jj fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fowles committed Aug 22, 2024
1 parent 8ead72e commit ac7fa1a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion cli/src/commands/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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'",
Expand All @@ -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
Expand All @@ -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`
Expand Down
6 changes: 5 additions & 1 deletion cli/tests/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -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'",
Expand All @@ -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
Expand All @@ -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`
Expand Down

0 comments on commit ac7fa1a

Please sign in to comment.