UNCRUSTIFY(1)

🌸 NAME 🌸

okay so bestie, welcome to the uncrustify manual page β€” section 1, User Commands, and it's literally a C, C++, C#, D, Java and Pawn source code beautifier πŸ’…βœ¨. yes she does all of those. no cap.


πŸŽ€ SYNOPSIS πŸŽ€

uncrustify [OPTIONS] [FILES]

that's it. that's the whole vibe. πŸ¦‹


πŸ’– DESCRIPTION πŸ’–

so here's the tea, bestie β˜•:

  • If you don't hand her any input files, she reads the input from stdin. πŸ‘€
  • And if you're reading from stdin, you should tell her the language using -l. fr fr, she needs to know.
  • If -F is used, or if files are just chillin' on the command line, the output filename is PFX + "/" + filename + SFX. That's the formula, periodt.
    • unless of course the options --replace or --no-backup are used. then it's a whole different story.
  • When reading from stdin or doing a single file via the '-f' option, the output is dumped to stdout, unless you redirect it with -o FILE. 🌈
  • Errors are always dumped to stderr. every single time. no exceptions. πŸ’€

✨ OPTIONS ✨

πŸ’… Basic Options:

  • -c CFG β€” use the config file CFG, or defaults if CFG is set to '-'. If you don't specify it, uncrustify will use $UNCRUSTIFY_CONFIG or $HOME/.uncrustify.cfg. she'll find it, don't worry 🫢
  • -f FILE β€” process the single file FILE, sending output to stdout or the file you picked with -o. one file, one moment, main character energy πŸ‘‘
  • -o FILE β€” redirect output to FILE. use this with -f, --update-config, --update-config-with-doc, --universalindent. those are her besties for this one.
  • --check β€” do not output the new text, instead verify that nothing changes when the file(s) are processed. the status of every file is printed to stderr. the exit code is EXIT_SUCCESS if there were no changes, EXIT_FAILURE otherwise. it's giving "vibe check but for your formatting" ✨
  • -F FILE β€” read files to process from FILE, one filename per line. if FILE is Β΄-Β΄ then read filenames from standard input instead of a file. you can create this file using something like Β΄find . -name "*.c" > list.txtΒ΄. πŸ“
    • this cannot be combined with -f. nope. not happening.
  • --prefix PFX β€” prepend PFX to the output filename path.
    • this cannot be combined with -f, --replace, or --no-backup.
  • --suffix SFX β€” append SFX to the output filename.
    • the default is '.uncrustify' if neither SFX or PFX are specified.
    • this cannot be combined with -f, --replace, or --no-backup.
  • --frag β€” assume the input is a code fragment and the first line is properly indented. little snippet treatment, we love her 🧚
  • --replace β€” replace source files (creates a backup). she's bold but she's careful πŸ’…
    • this cannot be combined with -f, --prefix, or --suffix.
  • --no-backup β€” replace files, no backup. useful if files are under source control. no backup bestie, she said what she said 😭
    • this cannot be combined with -f, --prefix, or --suffix.
  • --if-changed β€” write to stdout (or create output FILE) only if a change was detected. no change, no noise. iconic. πŸ”₯
  • --mtime β€” preserve mtime on replaced files. her timestamps stay untouched, as they should. ⭐
  • -l β€” language override: C, CPP, D, CS, JAVA, PAWN, VALA, OC, OC+
  • -t β€” load a file with types (usually not needed). lowkey optional.
  • -q β€” quiet mode β€” no output on stderr (-L will override). shhh 🀫

πŸŽ€ Config/Help Options:

  • -h, -?, --help, --usage β€” print this message and exit. she's helping, she's humble 🫢
  • --version β€” print the version and exit.
  • --count-options β€” print the number of available options and exit. yes, she counted. all of them. 😌
  • --show-config β€” print out option documentation and exit.
  • --update-config β€” output a new config file.
  • --update-config-with-doc β€” output a new config file with embedded usage comments.
  • --universalindent β€” output a config file for Universal Indent GUI.
  • --detect β€” detects the config from a source file. use with '-f FILE'. detection is currently fairly limited, so manage your expectations bestie πŸ’œ
  • --tracking space:FILE β€” prepare space tracking information for debugging.
  • --tracking nl:FILE β€” prepare newline tracking information for debugging.
  • --tracking start:FILE β€” prepare start of statement tracking information for debugging.
    • cannot be used with the -o option.

πŸ”₯ Debug Options:

  • -p FILE β€” dump debug info into FILE, or to stdout if FILE is set to '-'.
    • must be used in combination with '-f FILE'.
  • -ds FILE, --dump-steps FILE β€” dump parsing info at various moments of the formatting process.
    • this creates a series of files named 'FILE_nnn.log', each corresponding to a formatting step in uncrustify. 🌈
    • the file 'FILE_000.log' lists the formatting options in use.
    • must be used in combination with '-f FILE'.
  • -L SEV β€” set the log severity (see log_levels.h).
  • -s β€” show the log severity in the logs.
  • --decode FLAG β€” print FLAG as text and exit.

🌈 EXAMPLES 🌈

Read a D file from stdin, output to stdout.

cat foo.d | uncrustify -q -c my.cfg -l d

Process a file, output to stdout.

uncrustify -c my.cfg -d foo.d

Process a source tree, output to a different tree.

find src -name "*.[ch]" > files.txt
uncrustify -c my.cfg -F files.txt --prefix out

Process a source tree in-place.

uncrustify -c my.cfg --no-backup $(find src -name "*.[ch]")

⭐ NOTES ⭐

use comments containing ' *INDENT-OFF*' and ' *INDENT-ON*' to disable processing of parts of the source file. like a little "do not disturb" sign for your code πŸŽ€ iykyk.


πŸ’œ AUTHOR πŸ’œ

Written by Ben Gardner. we stan. πŸ‘‘


πŸ¦‹ REPORTING BUGS πŸ¦‹

use the issue tracker at <http://sourceforge.net/projects/uncrustify>. she wants to hear from you, fr fr.


  • Copyright (C) 2006‐2014 Ben Gardner
  • Copyright (C) 2015, 2016 Guy Maurel

πŸ‘‘ LICENSE πŸ‘‘

GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>

this is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. read that again bestie, NO warranty, she's honest about it πŸ’€


and that's the whole page 🫢 this was uncrustify β€” page for section 1 of the manual, dated Oct 2014, version vibes included β€” go format something gorgeous, mwah πŸ’‹βœ¨πŸŒΈ