Skip to content

Commit 7cfa88b

Browse files
cushongoogle-java-format Team
authored andcommitted
Fix the flag name in the error for using --dry-run with --replace.
The error said `--in-place`, which isn't a `google-java-format` flag; the in-place flags are `-i`, `-r`, `-replace` and `--replace`. Fixes #1094 PiperOrigin-RevId: 1009769348
1 parent 044bbe6 commit 7cfa88b

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎core/src/main/java/com/google/googlejavaformat/java/Main.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static CommandLineOptions processArgs(String... args) throws UsageException {
282282
"--assume-filename is only supported when formatting standard input");
283283
}
284284
if (parameters.dryRun() && parameters.inPlace()) {
285-
throw new UsageException("cannot use --dry-run and --in-place at the same time");
285+
throw new UsageException("cannot use --dry-run and --replace at the same time");
286286
}
287287
return parameters;
288288
}

‎core/src/test/java/com/google/googlejavaformat/java/CommandLineFlagsTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public void inPlaceDryRun() {
156156
} catch (UsageException e) {
157157
assertThat(e)
158158
.hasMessageThat()
159-
.contains("cannot use --dry-run and --in-place at the same time");
159+
.contains("cannot use --dry-run and --replace at the same time");
160160
}
161161
}
162162

0 commit comments

Comments
 (0)