format#
Configure (if needed) and apply or check code formatting.
clibra format --preset format # apply all formatters
clibra format --check clang --preset format # check clang-format only
clibra format --check cmake --preset format # check cmake-format only
Requires LIBRA_FORMAT to be ON in the preset’s
CMake cache.
With no --check, clibra format applies formatting by running
both the format-clang and format-cmake targets. With
--check clang or --check cmake it instead runs the corresponding
check-only target and does not modify files. If a target is unavailable,
clibra emits an error with the reason reported by the build system
rather than a generic failure.
CMake equivalent#
# Apply (default)
cmake --build --preset <name> --target format-clang
cmake --build --preset <name> --target format-cmake
# Check only
cmake --build --preset <name> --target format-check-clang # --check clang
cmake --build --preset <name> --target format-check-cmake # --check cmake
For tool-specific configuration (style files, extra args, etc.) see Static analysis.
Flag reference#
clibra format#
Configure (if needed) and check/apply formatting.
Requires LIBRA_FORMAT=ON in the preset’s CMake cache. The preset defaults to format if not given.
Attempts to apply formatting by default. Has suboptions for checking formatting.
Usage: clibra format [OPTIONS]
Options:#
-D <VAR=VALUE>-r,--reconfigure— Force the configure step even if the build directory exists-f,--fresh— Reconfigure with a –fresh cmake build directory-c,--check <CHECK>— The check to run. Defaults to nothingPossible values:
clang,cmake-k,--keep-going— Continue building after errors. Only valid with {Ninja, Unix Makefiles} generators