File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
docs/modules/pkl-cli/pages
pkl-cli/src/main/kotlin/org/pkl/cli Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -741,9 +741,9 @@ pkl shell-completion zsh
741741This command formats or checks formatting of Pkl files. +
742742Exit codes:
743743
744- * 0: No violations found.
744+ * 0: No violations found or files were updated .
745745* 1: An unexpected error happened (ex.: IO error)
746- * 11: Violations were found.
746+ * 11: Violations were found (when running without `--write`) .
747747
748748If the path is a directory, recursively looks for files with a `.pkl` extension, or files named `PklProject`.
749749
Original file line number Diff line number Diff line change @@ -110,14 +110,16 @@ constructor(
110110
111111 val formatted = format(contents)
112112 if (contents != formatted) {
113- status.update(FORMATTING_VIOLATION )
114113 if (diffNameOnly || overwrite) {
115114 // if `--diff-name-only` or `-w` is specified, only write file names
116115 writeLine(pathStr)
117116 }
118117
119118 if (overwrite) {
120119 path.writeText(formatted, Charsets .UTF_8 )
120+ } else {
121+ // only exit on violation for "check" operations, not when overwriting
122+ status.update(FORMATTING_VIOLATION )
121123 }
122124 }
123125
You can’t perform that action at this time.
0 commit comments