1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/clang-format.md
Vitor Henrique c8f956319f
pages*: simplify page description (#12149)
Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
2024-02-14 21:25:13 +01:00

24 lines
744 B
Markdown

# clang-format
> Auto-format C/C++/Java/JavaScript/Objective-C/Protobuf/C# code.
> More information: <https://clang.llvm.org/docs/ClangFormat.html>.
- Format a file and print the result to `stdout`:
`clang-format {{path/to/file}}`
- Format a file in-place:
`clang-format -i {{path/to/file}}`
- Format a file using a predefined coding style:
`clang-format --style={{LLVM|GNU|Google|Chromium|Microsoft|Mozilla|WebKit}} {{path/to/file}}`
- Format a file using the `.clang-format` file in one of the parent directories of the source file:
`clang-format --style=file {{path/to/file}}`
- Generate a custom `.clang-format` file:
`clang-format --style={{LLVM|GNU|Google|Chromium|Microsoft|Mozilla|WebKit}} --dump-config > {{.clang-format}}`