Skip to content

Commit 0a55fa6

Browse files
authored
Merge pull request #706 from jaredponn/jaredponn/add-in-place-option-for-cmake-format
Add an `inPlace` option for cmake-format
2 parents 9f7e991 + ba93239 commit 0a55fa6

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

modules/hooks.nix

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,11 @@ in
315315
default = "";
316316
example = ".cmake-format.json";
317317
};
318+
inPlace = mkOption {
319+
type = types.bool;
320+
description = "Format files in place (`--in-place`) instead of only checking formatting (`--check`).";
321+
default = false;
322+
};
318323
};
319324
};
320325
};
@@ -3016,8 +3021,10 @@ in
30163021
# Searches automatically for the config path.
30173022
then ""
30183023
else "-C ${hooks.cmake-format.settings.configPath}";
3024+
modeFlag =
3025+
if hooks.cmake-format.settings.inPlace then "--in-place" else "--check";
30193026
in
3020-
"${hooks.cmake-format.package}/bin/cmake-format --check ${maybeConfigPath}";
3027+
"${hooks.cmake-format.package}/bin/cmake-format ${modeFlag} ${maybeConfigPath}";
30213028
files = "\\.cmake$|CMakeLists.txt";
30223029
};
30233030
commitizen =

0 commit comments

Comments
 (0)