CLANG-FORMAT-DIFF.PY(1)
π NAME
clang-format-diff.py β bestie, it's literally the manual page for clang-format-diff.py 11 π
β¨ DESCRIPTION
okay so first things first, here's how you even call this thing:
usage: clang-format-diff.py [-h] [-i] [-p NUM] [-regex PATTERN]
[-iregex PATTERN] [-sort-includes] [-v]
[-style STYLE] [-binary BINARY]
So what does it do? This script reads input from a unified diff and reformats all the changed lines. π¦ Translation: it only touches the lines your patch actually messed with. That's the whole slay β if you've got a specific patch and you want just those lines looking pretty, this is your girl.
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, no cap: the filename inside the diff is used unmodified to figure out which source file to update. So if you're calling this script directly, bestie, be so careful that the path in the diff is correct relative to the current working directory. It's giving "trust me bro" energy and you should NOT trust it blindly. π
π«Ά options:
-h,--helpβ shows this help message and then dips. exit. gone. β¨-iβ actually applies the edits to your files instead of just showing you a diff. it's giving commitment. π-p NUMβ strips the smallest prefix containing P slashes. yes, the number matters, don't skip it.-regex PATTERNβ a custom pattern that picks which file paths get reformatted. case sensitive, and it overrides-iregex. main character energy, honestly.-iregex PATTERNβ same deal, custom pattern selecting file paths to reformat, but case insensitive. and it gets overridden by-regex, so know your place bestie π-sort-includesβ letsclang-formatsort the include blocks. go off, alphabetize. πΈ-v,--verboseβ be more verbose. lowkey useless without-ithough, fr fr.-style STYLEβ the formatting style to apply. your options areLLVM,GNU,Google,Chromium,Microsoft,Mozilla,WebKit. pick your aesthetic π-binary BINARYβ where the binary you wanna use forclang-formatlives. path goes here.
and that's the whole page, babe π§ this was clang-format-diff.py 11, dated January 2022 β go forth and format, you're gonna ate πβ
π¦ where this page comes from
- ubuntu jammy: clang-format-11 1:11.1.0-6 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms