CLANG-FORMAT-DIFF.PY(1)
π CLANG-FORMAT-DIFF.PY π
okay bestie, so we're looking at clang-format-diff.py β that's the manual page for clang-format-diff.py version 13, living in the User Commands corner of the manual. pull up a chair π
πΈ NAME πΈ
clang-format-diff.py β the manual page for clang-format-diff.py 13. that's it, that's the name, no notes π
β¨ DESCRIPTION β¨
so the usage line goes like this, no cap:
usage: clang-format-diff.py [-h] [-i] [-p NUM] [-regex PATTERN]
[-iregex PATTERN] [-sort-includes] [-v]
[-style STYLE] [-binary BINARY]
here's the tea π: this script reads input from a unified diff and reformats all the changed lines. it's lowkey perfect for when you want to reformat literally every line a specific patch touched. main character behaviour, honestly.
example usage for all my 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 heads-up: the filename inside the diff is used unmodified to figure out which source file to update. so if you're calling this script directly, be careful fr fr β make sure the path in the diff is actually correct relative to your current working directory. don't be sloppy, it's giving consequences π
π§ options:
-h,--helpβ shows this help message and then dips. exit stage left. π-iβ actually applies the edits to your files instead of just showing you a diff. it's the "do it, don't just talk about it" flag.-p NUMβ strips the smallest prefix that contains P slashes. bye bye path prefix π¦-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 this one is case insensitive. and heads up: it gets overridden by-regex. so-regexis the one holding the crown here π-sort-includesβ letsclang-formatsort the include blocks. let it cook π³-v,--verboseβ be more verbose. lowkey useless without-itho, just so you know π-style STYLEβ the formatting style to apply. your options areLLVM,GNU,Google,Chromium,Microsoft,Mozilla,WebKit. pick your fighter β¨-binary BINARYβ the location of the binary to use forclang-format. point it at your fave π«Ά
and that's the whole page bestie, you ate that π
this was clang-format-diff.py version 13, and the page is dated July 2023 β consider this your little sign-off from the manpage girlies πΈβ¨ slay, go reformat something, periodt π
π¦ where this page comes from
- ubuntu jammy: clang-format-13 1:13.0.1-2ubuntu2.2 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms