HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

uncrustify — C, C++, C#, D, Java, and Pawn source code formatter. More information: <https://manned.org/uncrustif

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commanduncrustifyandsourceclicodejavapawn

Problem

How to use the uncrustify command: C, C++, C#, D, Java, and Pawn source code formatter. More information: <https://manned.org/uncrustify>.

Solution

uncrustify — C, C++, C#, D, Java, and Pawn source code formatter. More information: <https://manned.org/uncrustify>.

Format a single file:
uncrustify -f {{path/to/file.cpp}} -o {{path/to/output.cpp}}


Read filenames from stdin, and take backups before writing output back to the original filepaths:
find . -name "*.cpp" | uncrustify -F - --replace


Don't make backups (useful if files are under version control):
find . -name "*.cpp" | uncrustify -F - --no-backup


Use a custom configuration file and write the result to stdout:
uncrustify -c {{path/to/uncrustify.cfg}} -f {{path/to/file.cpp}}


Explicitly set a configuration variable's value:
uncrustify --set {{option}}={{value}}


Generate a new configuration file:
uncrustify --update-config -o {{path/to/new.cfg}}

Code Snippets

Format a single file

uncrustify -f {{path/to/file.cpp}} -o {{path/to/output.cpp}}

Read filenames from `stdin`, and take backups before writing output back to the original filepaths

find . -name "*.cpp" | uncrustify -F - --replace

Don't make backups (useful if files are under version control)

find . -name "*.cpp" | uncrustify -F - --no-backup

Use a custom configuration file and write the result to `stdout`

uncrustify -c {{path/to/uncrustify.cfg}} -f {{path/to/file.cpp}}

Explicitly set a configuration variable's value

uncrustify --set {{option}}={{value}}

Context

tldr-pages: common/uncrustify

Revisions (0)

No revisions yet.