From 1cf789218e06a3b1c6e89db5a40754c0547e35f6 Mon Sep 17 00:00:00 2001 From: Alex Abashev Date: Sun, 29 Nov 2026 11:53:40 +0300 Subject: [PATCH] Give each way to install the command line tool a page of its own The Command line page held four ways to install (Homebrew, apt, Scoop, mise), the manual download and the usage reference, and the navigation showed one entry for all of it. Command line is now a section, as Library rules is: its index keeps the usage (Format and check, Options, Exit codes) at the same URL, and mise, Homebrew, Scoop, apt and Download each have a page. Get started shows a card for each, grouped under In the build, On the command line, In the editor and In CI. The apt page gives the fingerprint of the repository's signing key, which is not the release key. Links to the old sections of the page now point to the pages that hold them. --- docs/about.md | 2 +- docs/ai-agents.md | 2 +- docs/get-started/command-line.md | 194 ---------------------- docs/get-started/command-line/apt.md | 44 +++++ docs/get-started/command-line/download.md | 68 ++++++++ docs/get-started/command-line/homebrew.md | 24 +++ docs/get-started/command-line/index.md | 94 +++++++++++ docs/get-started/command-line/mise.md | 33 ++++ docs/get-started/command-line/scoop.md | 25 +++ docs/get-started/github-actions.md | 2 +- docs/get-started/index.md | 57 ++++++- docs/get-started/intellij-idea.md | 2 +- docs/index.md | 10 +- docs/migrate.md | 2 +- docs/playground/index.md | 6 +- zensical.toml | 9 +- 16 files changed, 363 insertions(+), 211 deletions(-) delete mode 100644 docs/get-started/command-line.md create mode 100644 docs/get-started/command-line/apt.md create mode 100644 docs/get-started/command-line/download.md create mode 100644 docs/get-started/command-line/homebrew.md create mode 100644 docs/get-started/command-line/index.md create mode 100644 docs/get-started/command-line/mise.md create mode 100644 docs/get-started/command-line/scoop.md diff --git a/docs/about.md b/docs/about.md index 04d9c48..e686f24 100644 --- a/docs/about.md +++ b/docs/about.md @@ -56,7 +56,7 @@ Central and the Gradle Plugin Portal. They are made with the project's release k The key is published on [keys.openpgp.org](https://keys.openpgp.org). Import it once, then check the checksum file of a release, and the checksum file against your download as shown on the -[Command line](get-started/command-line.md#verify-the-download) page. +[Download](get-started/command-line/download.md#verify-the-download) page. ``` sh curl -sSL https://keys.openpgp.org/vks/v1/by-fingerprint/13A6BDF2DAA98D3D573B33EA100481FDAEE94DE9 | gpg --import diff --git a/docs/ai-agents.md b/docs/ai-agents.md index 3a5452a..aa67694 100644 --- a/docs/ai-agents.md +++ b/docs/ai-agents.md @@ -69,7 +69,7 @@ The four layers back each other up, so use as many as you can. session. A `PostToolUse` hook on the `Edit` and `Write` tools runs after every file the agent changes, and it gets the tool call as JSON on its standard input. -The hook needs `open-java-format` on the `PATH`, see [Command line](get-started/command-line.md), +The hook needs `open-java-format` on the `PATH`, see [Command line](get-started/command-line/index.md), and [`jq`](https://jqlang.org/), which takes the path of the file out of that JSON. ``` json title=".claude/settings.json" diff --git a/docs/get-started/command-line.md b/docs/get-started/command-line.md deleted file mode 100644 index 456a11b..0000000 --- a/docs/get-started/command-line.md +++ /dev/null @@ -1,194 +0,0 @@ -# Command line - -The formatter comes as a native binary that needs no Java, and as a runnable jar for every platform -the binaries do not cover. Homebrew on macOS and Linux, apt on Ubuntu and Debian and Scoop on -Windows install the binary and keep it current; mise installs it on all three and pins its version -per project. - -## Homebrew - -``` sh -brew install openjavaformat/tap/open-java-format -open-java-format --version -``` - -The formula comes from our tap, [openjavaformat/homebrew-tap](https://github.com/openjavaformat/homebrew-tap). -It downloads the native binary of the latest release from GitHub, checks it against the release's -checksums and puts `open-java-format` on your `PATH`. It covers macOS on Apple silicon and Intel and -Linux on x86-64 and AArch64; on Windows, use [Scoop](#scoop) or [mise](#mise). Homebrew fetches the -file with `curl`, so macOS does not quarantine it. - -`brew upgrade` takes each new release, at the latest an hour after it is published. A new minor -version can change the output (see [Versions](../about.md#versions)): `brew pin open-java-format` -holds the installed one. - -## apt - -``` sh -sudo install -d -m 0755 /etc/apt/keyrings -curl -fsSL https://apt.openjavaformat.dev/key.asc | sudo tee /etc/apt/keyrings/open-java-format.asc > /dev/null -echo "deb [signed-by=/etc/apt/keyrings/open-java-format.asc] https://apt.openjavaformat.dev stable main" \ - | sudo tee /etc/apt/sources.list.d/open-java-format.list -sudo apt update -sudo apt install open-java-format -``` - -The lines add our apt repository, [openjavaformat/apt](https://github.com/openjavaformat/apt), with -the key that signs it, and install the native binary of the latest release as -`/usr/bin/open-java-format`. The package is there for amd64 and arm64 and needs glibc 2.34 or later: -Ubuntu 22.04 or Debian 12 and newer. - -`sudo apt upgrade` takes each new release, at the latest an hour after it is published. A new minor -version can change the output (see [Versions](../about.md#versions)): -`sudo apt-mark hold open-java-format` holds the installed one. The repository carries the latest -version only; older versions are binaries to download, as below. - -## Scoop - -``` powershell -scoop bucket add openjavaformat https://github.com/openjavaformat/scoop-bucket -scoop install openjavaformat/open-java-format -open-java-format --version -``` - -The manifest comes from our bucket, [openjavaformat/scoop-bucket](https://github.com/openjavaformat/scoop-bucket). -It downloads the Windows x64 binary of the latest release from GitHub, checks it against the release's -checksums and puts `open-java-format` on your `PATH`, for your user and without administrator rights. -Scoop needs Git to add a bucket: run `scoop install git` first if you have none. On Windows 11 on -ARM, Scoop installs the same x64 binary, and Windows runs it under emulation. - -`scoop update` fetches the bucket, and `scoop update open-java-format` then takes the new release, at -the latest an hour after it is published. `scoop hold open-java-format` holds the installed version. - -## mise - -``` sh -mise use github:openjavaformat/open-java-format@{{ ojf_version }} -open-java-format --version -``` - -[mise](https://mise.jdx.dev) installs the tool from the GitHub release with its -[github backend](https://mise.jdx.dev/dev-tools/backends/github.html): it picks the native binary for -your platform, checks it against the digest GitHub publishes and the release's build attestation, and -puts `open-java-format` on your `PATH`. That works on macOS, on Linux with glibc and on Windows -x86-64. On Windows on ARM and on musl-based Linux it would pick the wrong file, so use the jar there. - -`mise use` writes the version into the project's `mise.toml`, so everyone on the project formats with -the same one: - -``` toml title="mise.toml" -[tools] -"github:openjavaformat/open-java-format" = "{{ ojf_version }}" -``` - -Add `-g` to install it for your user instead of one project. Without a version, `mise use` writes -`latest`, and `mise upgrade` then takes each new release. A new minor version can change the output -(see [Versions](../about.md#versions)), which is why the example pins one. - -## Download - -Pick the file for your platform from the -[latest release](https://github.com/openjavaformat/open-java-format/releases/latest). - -| Platform | File | -| --- | --- | -| Linux x86-64, glibc | `open-java-format-linux-glibc_x86-64` | -| Linux AArch64, glibc | `open-java-format-linux-glibc_aarch64` | -| macOS, Apple silicon | `open-java-format-macos_aarch64` | -| macOS, Intel | `open-java-format-macos_x86-64` | -| Windows, x86-64 | `open-java-format-windows_x86-64.exe` | -| Anything else with Java 21 or later | `open-java-format-{{ ojf_version }}-all.jar` | - -The Linux binaries need glibc 2.34 or later. There is no native binary for Windows on ARM, but -Windows 11 runs the x64 one under emulation. For musl-based Linux such as Alpine there is none: use -the jar there. - -``` sh title="Native binary, here for Apple silicon" -curl -LO https://github.com/openjavaformat/open-java-format/releases/download/{{ ojf_version }}/open-java-format-macos_aarch64 -chmod +x open-java-format-macos_aarch64 -./open-java-format-macos_aarch64 --version -``` - -Rename the file to `open-java-format`, or `open-java-format.exe` on Windows, and move it to a -directory on your `PATH`. The examples below assume you did. - -!!! note "macOS and files downloaded with a browser" - - macOS refuses to run a binary that a browser downloaded. Clear the quarantine flag first with - `xattr -d com.apple.quarantine open-java-format-macos_aarch64`. A file fetched with `curl` does - not get the flag. - -``` sh title="Runnable jar" -curl -LO https://github.com/openjavaformat/open-java-format/releases/download/{{ ojf_version }}/open-java-format-{{ ojf_version }}-all.jar -java -jar open-java-format-{{ ojf_version }}-all.jar --version -``` - -The jar carries its dependencies and the `Add-Exports` entries the formatter needs, so it runs -without JVM flags. - -## Verify the download - -Every release has a `checksums_sha256.txt`. Download it next to your file and check: - -=== "macOS" - - ``` sh - shasum -a 256 --ignore-missing -c checksums_sha256.txt - ``` - -=== "Linux" - - ``` sh - sha256sum --ignore-missing -c checksums_sha256.txt - ``` - -## Format and check - -There is one style, so no flag chooses it. Version 2.98.0.1 needed `--ojf`: later versions still -accept it, print a warning and format as usual, so drop it from your scripts. - -``` sh title="Format files in place" -open-java-format --replace src/main/java/com/example/Hello.java -``` - -``` sh title="Format every tracked Java file" -open-java-format --replace $(git ls-files '*.java') -``` - -``` sh title="Check without changing anything" -open-java-format --dry-run --set-exit-if-changed $(git ls-files '*.java') -``` - -The check prints the files that would change and exits with 1 if there are any, which is what a CI -step needs. - -``` sh title="Format standard input" -cat Hello.java | open-java-format - -``` - -## Options - -| Option | What it does | -| --- | --- | -| `--replace`, `-i` | Write the result back to the files instead of printing it | -| `--dry-run`, `-n` | Print the files that would change, change nothing | -| `--set-exit-if-changed` | Exit with 1 if anything would change | -| `-` | Format standard input to standard output | -| `--lines 5:10` | Format only these lines, counted from 1 | -| `--fix-imports-only` | Sort imports and remove unused ones, format nothing else | -| `--skip-sorting-imports` | Leave the import order alone | -| `--skip-removing-unused-imports` | Keep unused imports | -| `--skip-reflowing-long-strings` | Do not rewrap string literals that pass the column limit | -| `@file` | Read options and file names from a file | -| `--version`, `--help` | Print the version, or every option | - -## Exit codes - -| Code | Meaning | -| --- | --- | -| 0 | Every file was formatted or checked without a problem | -| 1 | With `--set-exit-if-changed`: a file is not formatted | -| 2 | A file could not be read, parsed or written, or an option is wrong. The reason is on standard error | - -A file that does not parse is left as it is. When a run hits both, a file that is not formatted and -one it cannot format, the exit code is 2. diff --git a/docs/get-started/command-line/apt.md b/docs/get-started/command-line/apt.md new file mode 100644 index 0000000..57fb947 --- /dev/null +++ b/docs/get-started/command-line/apt.md @@ -0,0 +1,44 @@ +# apt + +apt installs the native binary on Ubuntu and Debian, for amd64 and arm64, and `apt upgrade` takes each +new release. + +``` sh +sudo install -d -m 0755 /etc/apt/keyrings +curl -fsSL https://apt.openjavaformat.dev/key.asc | sudo tee /etc/apt/keyrings/open-java-format.asc > /dev/null +echo "deb [signed-by=/etc/apt/keyrings/open-java-format.asc] https://apt.openjavaformat.dev stable main" \ + | sudo tee /etc/apt/sources.list.d/open-java-format.list +sudo apt update +sudo apt install open-java-format +open-java-format --version +``` + +The lines add our apt repository, [openjavaformat/apt](https://github.com/openjavaformat/apt), with +the key that signs it, and install the native binary of the latest release as +`/usr/bin/open-java-format`. The package needs glibc 2.34 or later: Ubuntu 22.04 or Debian 12 and +newer. + +## Check the key + +The repository is signed by a key of its own, not by the +[release key](../../about.md#verify-a-download) that signs the files of a GitHub release. Its +fingerprint is: + +``` text +5098 A90C 44ED 5129 8CB5 C476 D8F1 EFB5 9EE1 EB3C +``` + +To compare it with the key you downloaded, run +`gpg --show-keys /etc/apt/keyrings/open-java-format.asc`, which prints the fingerprint without the +spaces. + +## Update and hold + +`sudo apt upgrade` takes each new release, at the latest an hour after it is published. A new minor +version can change the output (see [Versions](../../about.md#versions)): +`sudo apt-mark hold open-java-format` holds the installed one. The repository carries the latest +version only; older versions are binaries to [download](download.md). + +## Next + +[Format and check](index.md#format-and-check) shows what to run once it is installed. diff --git a/docs/get-started/command-line/download.md b/docs/get-started/command-line/download.md new file mode 100644 index 0000000..b7690ce --- /dev/null +++ b/docs/get-started/command-line/download.md @@ -0,0 +1,68 @@ +# Download + +Every release has a native binary for each platform it covers, and a runnable jar for all the rest. +Take the file by hand when none of the package managers fits: [mise](mise.md), +[Homebrew](homebrew.md), [Scoop](scoop.md) and [apt](apt.md) install the same binary and keep it +current. + +Pick the file for your platform from the +[latest release](https://github.com/openjavaformat/open-java-format/releases/latest). + +| Platform | File | +| --- | --- | +| Linux x86-64, glibc | `open-java-format-linux-glibc_x86-64` | +| Linux AArch64, glibc | `open-java-format-linux-glibc_aarch64` | +| macOS, Apple silicon | `open-java-format-macos_aarch64` | +| macOS, Intel | `open-java-format-macos_x86-64` | +| Windows, x86-64 | `open-java-format-windows_x86-64.exe` | +| Anything else with Java 21 or later | `open-java-format-{{ ojf_version }}-all.jar` | + +The Linux binaries need glibc 2.34 or later. There is no native binary for Windows on ARM, but +Windows 11 runs the x64 one under emulation. For musl-based Linux such as Alpine there is none: use +the jar there. + +## Native binary + +``` sh title="Native binary, here for Apple silicon" +curl -LO https://github.com/openjavaformat/open-java-format/releases/download/{{ ojf_version }}/open-java-format-macos_aarch64 +chmod +x open-java-format-macos_aarch64 +./open-java-format-macos_aarch64 --version +``` + +Rename the file to `open-java-format`, or `open-java-format.exe` on Windows, and move it to a +directory on your `PATH`. The examples on the [Command line](index.md#format-and-check) page assume +you did. + +!!! note "macOS and files downloaded with a browser" + + macOS refuses to run a binary that a browser downloaded. Clear the quarantine flag first with + `xattr -d com.apple.quarantine open-java-format-macos_aarch64`. A file fetched with `curl` does + not get the flag. + +## Runnable jar + +``` sh title="Runnable jar" +curl -LO https://github.com/openjavaformat/open-java-format/releases/download/{{ ojf_version }}/open-java-format-{{ ojf_version }}-all.jar +java -jar open-java-format-{{ ojf_version }}-all.jar --version +``` + +The jar carries its dependencies and the `Add-Exports` entries the formatter needs, so it runs +without JVM flags. It needs Java 21 or later. + +## Verify the download + +Every release has a `checksums_sha256.txt`. Download it next to your file and check: + +=== "macOS" + + ``` sh + shasum -a 256 --ignore-missing -c checksums_sha256.txt + ``` + +=== "Linux" + + ``` sh + sha256sum --ignore-missing -c checksums_sha256.txt + ``` + +The files are signed too: [About](../../about.md#verify-a-download) shows how to check the signature. diff --git a/docs/get-started/command-line/homebrew.md b/docs/get-started/command-line/homebrew.md new file mode 100644 index 0000000..048e5e8 --- /dev/null +++ b/docs/get-started/command-line/homebrew.md @@ -0,0 +1,24 @@ +# Homebrew + +Homebrew installs the native binary on macOS and Linux, and `brew upgrade` takes each new release. + +``` sh +brew install openjavaformat/tap/open-java-format +open-java-format --version +``` + +The formula comes from our tap, [openjavaformat/homebrew-tap](https://github.com/openjavaformat/homebrew-tap). +It downloads the native binary of the latest release from GitHub, checks it against the release's +checksums and puts `open-java-format` on your `PATH`. It covers macOS on Apple silicon and Intel and +Linux on x86-64 and AArch64; on Windows, use [Scoop](scoop.md) or [mise](mise.md). Homebrew fetches +the file with `curl`, so macOS does not quarantine it. + +## Update and hold + +`brew upgrade` takes each new release, at the latest an hour after it is published. A new minor +version can change the output (see [Versions](../../about.md#versions)): `brew pin open-java-format` +holds the installed one. + +## Next + +[Format and check](index.md#format-and-check) shows what to run once it is installed. diff --git a/docs/get-started/command-line/index.md b/docs/get-started/command-line/index.md new file mode 100644 index 0000000..086862d --- /dev/null +++ b/docs/get-started/command-line/index.md @@ -0,0 +1,94 @@ +# Command line + +The formatter comes as a native binary that needs no Java, and as a runnable jar for every platform +the binaries do not cover. A package manager installs the binary and keeps it current; the other way +is to download it from the release. + +## Install + +
+ +- :lucide-wrench:{ .lg .middle } __[mise](mise.md)__ + + --- + + macOS, Linux and Windows. Pins the version in the project's `mise.toml`, so everyone on the + project formats with the same one. + +- :simple-homebrew:{ .lg .middle } __[Homebrew](homebrew.md)__ + + --- + + macOS and Linux, from our tap. `brew upgrade` takes each new release. + +- :fontawesome-brands-windows:{ .lg .middle } __[Scoop](scoop.md)__ + + --- + + Windows, from our bucket. Installs for your user, without administrator rights. + +- :simple-debian:{ .lg .middle } __[apt](apt.md)__ + + --- + + Ubuntu and Debian, from our signed repository. `apt upgrade` takes each new release. + +- :lucide-download:{ .lg .middle } __[Download](download.md)__ + + --- + + The native binary for Linux, macOS and Windows, or the runnable jar for every other platform + with Java 21 or later. Every file comes with a checksum. + +
+ +## Format and check + +There is one style, so no flag chooses it. Version 2.98.0.1 needed `--ojf`: later versions still +accept it, print a warning and format as usual, so drop it from your scripts. + +``` sh title="Format files in place" +open-java-format --replace src/main/java/com/example/Hello.java +``` + +``` sh title="Format every tracked Java file" +open-java-format --replace $(git ls-files '*.java') +``` + +``` sh title="Check without changing anything" +open-java-format --dry-run --set-exit-if-changed $(git ls-files '*.java') +``` + +The check prints the files that would change and exits with 1 if there are any, which is what a CI +step needs. + +``` sh title="Format standard input" +cat Hello.java | open-java-format - +``` + +## Options + +| Option | What it does | +| --- | --- | +| `--replace`, `-i` | Write the result back to the files instead of printing it | +| `--dry-run`, `-n` | Print the files that would change, change nothing | +| `--set-exit-if-changed` | Exit with 1 if anything would change | +| `-` | Format standard input to standard output | +| `--lines 5:10` | Format only these lines, counted from 1 | +| `--fix-imports-only` | Sort imports and remove unused ones, format nothing else | +| `--skip-sorting-imports` | Leave the import order alone | +| `--skip-removing-unused-imports` | Keep unused imports | +| `--skip-reflowing-long-strings` | Do not rewrap string literals that pass the column limit | +| `@file` | Read options and file names from a file | +| `--version`, `--help` | Print the version, or every option | + +## Exit codes + +| Code | Meaning | +| --- | --- | +| 0 | Every file was formatted or checked without a problem | +| 1 | With `--set-exit-if-changed`: a file is not formatted | +| 2 | A file could not be read, parsed or written, or an option is wrong. The reason is on standard error | + +A file that does not parse is left as it is. When a run hits both, a file that is not formatted and +one it cannot format, the exit code is 2. diff --git a/docs/get-started/command-line/mise.md b/docs/get-started/command-line/mise.md new file mode 100644 index 0000000..d33fa46 --- /dev/null +++ b/docs/get-started/command-line/mise.md @@ -0,0 +1,33 @@ +# mise + +[mise](https://mise.jdx.dev) installs the native binary and pins its version per project. It works on +macOS, on Linux with glibc and on Windows x86-64. + +``` sh +mise use github:openjavaformat/open-java-format@{{ ojf_version }} +open-java-format --version +``` + +mise installs the tool from the GitHub release with its +[github backend](https://mise.jdx.dev/dev-tools/backends/github.html): it picks the native binary for +your platform, checks it against the digest GitHub publishes and the release's build attestation, and +puts `open-java-format` on your `PATH`. On Windows on ARM and on musl-based Linux it would pick the +wrong file, so use the [runnable jar](download.md#runnable-jar) there. + +## Pin the version + +`mise use` writes the version into the project's `mise.toml`, so everyone on the project formats with +the same one: + +``` toml title="mise.toml" +[tools] +"github:openjavaformat/open-java-format" = "{{ ojf_version }}" +``` + +Add `-g` to install it for your user instead of one project. Without a version, `mise use` writes +`latest`, and `mise upgrade` then takes each new release. A new minor version can change the output +(see [Versions](../../about.md#versions)), which is why the example pins one. + +## Next + +[Format and check](index.md#format-and-check) shows what to run once it is installed. diff --git a/docs/get-started/command-line/scoop.md b/docs/get-started/command-line/scoop.md new file mode 100644 index 0000000..498420e --- /dev/null +++ b/docs/get-started/command-line/scoop.md @@ -0,0 +1,25 @@ +# Scoop + +Scoop installs the native binary on Windows, for your user and without administrator rights. + +``` powershell +scoop bucket add openjavaformat https://github.com/openjavaformat/scoop-bucket +scoop install openjavaformat/open-java-format +open-java-format --version +``` + +The manifest comes from our bucket, [openjavaformat/scoop-bucket](https://github.com/openjavaformat/scoop-bucket). +It downloads the Windows x64 binary of the latest release from GitHub, checks it against the release's +checksums and puts `open-java-format` on your `PATH`. Scoop needs Git to add a bucket: run +`scoop install git` first if you have none. On Windows 11 on ARM, Scoop installs the same x64 binary, +and Windows runs it under emulation. + +## Update and hold + +`scoop update` fetches the bucket, and `scoop update open-java-format` then takes the new release, at +the latest an hour after it is published. A new minor version can change the output (see +[Versions](../../about.md#versions)): `scoop hold open-java-format` holds the installed version. + +## Next + +[Format and check](index.md#format-and-check) shows what to run once it is installed. diff --git a/docs/get-started/github-actions.md b/docs/get-started/github-actions.md index 1f85ea2..39459bb 100644 --- a/docs/get-started/github-actions.md +++ b/docs/get-started/github-actions.md @@ -81,7 +81,7 @@ Code scanning is free on public repositories; a private repository needs GitHub ## Fix what the check found Run the formatter locally with the same version, then commit the result. See -[Command line](command-line.md) for the download. +[Command line](command-line/index.md) for the download. ``` sh open-java-format --replace path/to/File.java diff --git a/docs/get-started/index.md b/docs/get-started/index.md index 7ec8b54..71cde58 100644 --- a/docs/get-started/index.md +++ b/docs/get-started/index.md @@ -1,6 +1,6 @@ # Get started -open-java-format runs in the build, in the editor, on the command line and in CI. Every route uses +open-java-format runs in the build, on the command line, in the editor and in CI. Every route uses the same formatter, so they all produce the same files; the one exception is the `palantirJavaFormat` step of [Spotless](spotless.md#maven). Set up the ones your project needs. @@ -10,6 +10,8 @@ the same formatter, so they all produce the same files; the one exception is the later, and the Gradle plugin needs Gradle 9. The Maven plugin has version numbers of its own; the current one is **{{ maven_plugin_version }}**. +## In the build +
- :simple-gradle:{ .lg .middle } __[Gradle plugin](gradle.md)__ @@ -32,12 +34,53 @@ the same formatter, so they all produce the same files; the one exception is the Formats the sources in every build, or fails the build in CI when they are not formatted. -- :lucide-terminal:{ .lg .middle } __[Command line](command-line.md)__ +
+ +## On the command line + +The native binary needs no Java. Install it with a package manager, which keeps it current, or +download it. Once it is installed, [Command line](command-line/index.md) shows how to format files +and check them, with every option and exit code. + +
+ +- :lucide-wrench:{ .lg .middle } __[mise](command-line/mise.md)__ --- - A native binary for Linux, macOS and Windows, or a runnable jar anywhere else. Formats files in - place or checks them. + macOS, Linux and Windows. Pins the version in the project's `mise.toml`, so everyone on the + project formats with the same one. + +- :simple-homebrew:{ .lg .middle } __[Homebrew](command-line/homebrew.md)__ + + --- + + macOS and Linux, from our tap. `brew upgrade` takes each new release. + +- :fontawesome-brands-windows:{ .lg .middle } __[Scoop](command-line/scoop.md)__ + + --- + + Windows, from our bucket. Installs for your user, without administrator rights. + +- :simple-debian:{ .lg .middle } __[apt](command-line/apt.md)__ + + --- + + Ubuntu and Debian, from our signed repository. `apt upgrade` takes each new release. + +- :lucide-download:{ .lg .middle } __[Download](command-line/download.md)__ + + --- + + The native binary for Linux, macOS and Windows, or the runnable jar for every other platform + with Java 21 or later. Every file comes with a checksum. + +
+ +## In the editor + +
- :simple-intellijidea:{ .lg .middle } __[IntelliJ IDEA](intellij-idea.md)__ @@ -51,6 +94,12 @@ the same formatter, so they all produce the same files; the one exception is the Adds open-java-format as a formatter implementation for the Java editor. +
+ +## In CI + +
+ - :simple-githubactions:{ .lg .middle } __[GitHub Action and pre-commit](github-actions.md)__ --- diff --git a/docs/get-started/intellij-idea.md b/docs/get-started/intellij-idea.md index ea668d3..b724420 100644 --- a/docs/get-started/intellij-idea.md +++ b/docs/get-started/intellij-idea.md @@ -143,7 +143,7 @@ It is a setting of the IDE and works in any project, whether Maven, Gradle or ne ### A binary of your own -To run another binary, such as one from the [command line](command-line.md) page, choose it in +To run another binary, such as one from the [command line](command-line/index.md) page, choose it in **Binary** under **Native binary**. It takes the place of the embedded one; empty the field to go back to the embedded binary. diff --git a/docs/index.md b/docs/index.md index b706122..bc308fc 100644 --- a/docs/index.md +++ b/docs/index.md @@ -155,9 +155,10 @@ on the [Maven plugin](get-started/maven.md) page. ### On the command line Every [release](https://github.com/openjavaformat/open-java-format/releases/latest) carries native -binaries for Linux, macOS and Windows, and a runnable jar for Java 21 or later. Homebrew installs -the binary on macOS and Linux, [apt](get-started/command-line.md#apt) on Ubuntu and Debian, and -Scoop on Windows. +binaries for Linux, macOS and Windows, and a runnable jar for Java 21 or later. +[Homebrew](get-started/command-line/homebrew.md) installs the binary on macOS and Linux, +[apt](get-started/command-line/apt.md) on Ubuntu and Debian, and +[Scoop](get-started/command-line/scoop.md) on Windows. ``` sh title="Install with Homebrew" brew install openjavaformat/tap/open-java-format @@ -176,7 +177,8 @@ open-java-format --replace src/main/java/com/example/Hello.java open-java-format --dry-run --set-exit-if-changed $(git ls-files '*.java') ``` -Downloads, checksums and every option are on the [Command line](get-started/command-line.md) page. +The other ways to install it, the checksums and every option are in the +[Command line](get-started/command-line/index.md) section. ### In CI with GitHub Actions diff --git a/docs/migrate.md b/docs/migrate.md index e55e90e..0548e46 100644 --- a/docs/migrate.md +++ b/docs/migrate.md @@ -110,7 +110,7 @@ settings and multi-project builds. ### Command line and scripts Remove `--palantir`: there is one style, so no flag chooses it. Take the binary or the jar from -[our releases](get-started/command-line.md). +[our releases](get-started/command-line/download.md). !!! note "A leftover flag fails the run" diff --git a/docs/playground/index.md b/docs/playground/index.md index 666b3a7..4697d18 100644 --- a/docs/playground/index.md +++ b/docs/playground/index.md @@ -57,18 +57,18 @@ class Example {
diff --git a/zensical.toml b/zensical.toml index 27fef2f..42fb350 100644 --- a/zensical.toml +++ b/zensical.toml @@ -21,7 +21,14 @@ nav = [ { "Gradle plugin" = "get-started/gradle.md" }, { "Spotless" = "get-started/spotless.md" }, { "Maven plugin" = "get-started/maven.md" }, - { "Command line" = "get-started/command-line.md" }, + { "Command line" = [ + "get-started/command-line/index.md", + { "mise" = "get-started/command-line/mise.md" }, + { "Homebrew" = "get-started/command-line/homebrew.md" }, + { "Scoop" = "get-started/command-line/scoop.md" }, + { "apt" = "get-started/command-line/apt.md" }, + { "Download" = "get-started/command-line/download.md" }, + ] }, { "IntelliJ IDEA" = "get-started/intellij-idea.md" }, { "Eclipse" = "get-started/eclipse.md" }, { "GitHub Action and pre-commit" = "get-started/github-actions.md" },