CLANG-FORMAT-DIFF.PY(1)
π CLANG-FORMAT-DIFF.PY(1) π
okay bestie, welcome to the manual page for clang-format-diff.py (the one and only, version 14, living in the User Commands section like the icon it is) β¨
πΈ NAME πΈ
clang-format-diff.py β the manual page for clang-format-diff.py 14, no cap π
π¦ DESCRIPTION π¦
so like, here's how you're supposed to call her:
usage: clang-format-diff.py [-h] [-i] [-p NUM] [-regex PATTERN]
[-iregex PATTERN] [-sort-includes] [-v]
[-style STYLE] [-fallback-style FALLBACK_STYLE] [-binary BINARY]
okay so what does this lil script actually DO? she reads input from a unified diff and reformats all the changed lines. that's it, that's the vibe π
and it's lowkey so useful when you wanna reformat, like, only the lines that a specific patch touched. no sweeping the whole file, just the glow-up zone β¨
here's the 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
β οΈ ok important warning time, listen up bestie: 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, pls be careful and make sure the path in the diff is correct relative to the current working directory. fr fr, do a vibe check on your paths first π
β¨ options: β¨
-h,--helpβ show this help message and exit. the classic. she's giving "help me help you" π«Ά-iβ apply the edits to the files instead of just displaying a diff. this is the one that actually does the thing π-p NUMβ strip the smallest prefix containing P slashes. yes bestie, thatNUMis a number, and yes it matters π-regex PATTERNβ a custom pattern that picks which file paths get reformatted. she's case sensitive, and she overrides-iregexπ-iregex PATTERNβ a custom pattern that picks which file paths get reformatted, but make it case insensitive. lowkey she gets overridden by-regexthough, so know your hierarchy π₯²-sort-includesβ let clang-format sort the include blocks. organizing? we love to see it π-v,--verboseβ be more verbose. that's it. but heads up: she's ineffective without-i, so if you're not applying edits, the yapping does nothing π-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 is invoked with-style=file, but can not find the.clang-formatfile to use. she's the backup plan, the safety net, the ride-or-die π¦-binary BINARYβ the location of the binary to use for clang-format. point her at your fave π
and that's the whole page, bestie!! this was clang-format-diff.py 14, dated May 2025, straight out of the User Commands section π go reformat something and slay, ily, bye!! ππΈβ¨
π¦ where this page comes from
- ubuntu questing: clang-format-14 1:14.0.6-20ubuntu3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms