CLANG-FORMAT-DIFF.PY(1)
π CLANG-FORMAT-DIFF.PY π
okay bestie, gather round, because this one is literally the manual page for clang-format-diff.py version 17 and it's about to make your diffs cute. π
β¨ NAME β¨
clang-format-diff.py β the manual page for clang-format-diff.py 17, no cap π
πΈ DESCRIPTION πΈ
here's the vibe check, the usage goes like this:
clang-format-diff.py [-h] [-i] [-p NUM] [-regex PATTERN]
[-iregex PATTERN] [-sort-includes] [-v]
[-style STYLE] [-fallback-style FALLBACK_STYLE] [-binary BINARY]
so what does it DO? it reads input from a unified diff and reformats all the changed lines. that's the whole personality. π¦
and it's lowkey iconic because it means you can reformat exactly the lines that a specific patch touched β not the whole file, just the glow-up zone. β¨
example usage for the git/svn girlies:
git diff -U0 --no-color --relative HEAD^ | clang-format-diff.py -p1 -i
svn diff --diff-cmd=diff -x-U0 | clang-format-diff.py -i
β οΈ okay important, do NOT skip this part: the filename contained in the diff is used unmodified to figure out which source file to update. so if you're calling this script directly, be careful bestie β make sure the path in the diff is correct relative to the current working directory. fr fr, this is the part that bites people. π
π options: π
-h,--helpβ shows this help message and dips. bye π-iβ apply the edits to the files instead of just showing you a diff. this is the "actually do it" button. π₯-p NUMβ strip the smallest prefix containing P slashes.-regex PATTERNβ your own custom pattern for picking which file paths get reformatted. it's case sensitive, and it overrides-iregex.-iregex PATTERNβ same deal, custom pattern for picking file paths to reformat, but case insensitive. heads up though: it gets overridden by-regex.-sort-includesβ lets clang-format sort the include blocks. organize, slay. π-v,--verboseβ be more verbose. ngl it's ineffective without-i, so don't bother unless you're also applying edits.-style STYLEβ the formatting style to apply. your options areLLVM,GNU,Google,Chromium,Microsoft,Mozilla,WebKit. pick your fighter. π-fallback-style FALLBACK_STYLEβ the name of the predefined style used as a fallback in case clang-format gets invoked with-style=file, but can't find the.clang-formatfile to use. the backup bestie. π«Ά-binary BINARYβ where the binary to use for clang-format lives. path goes here. π
that's the whole page, you're officially fluent now. π
and a lil sign-off from me to you: this was clang-format-diff.py 17, dated June 2025 β go format something pretty, bestie. ππ§π
π¦ where this page comes from
- debian trixie: clang-format-17 1:17.0.6-22+b2 Β· APACHE-2-LLVM-EXCEPTIONS
- ubuntu questing: clang-format-17 1:17.0.6-22build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms