Guest User

Untitled

a guest
Mar 22nd, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. set -e -u
  4.  
  5. _main() {
  6. cat > .clang-format <<YAML
  7. ---
  8. Language: Cpp
  9. BasedOnStyle: Google
  10. AllowShortFunctionsOnASingleLine: None
  11. AlwaysBreakAfterDefinitionReturnType: true
  12. BreakBeforeBinaryOperators: None
  13. # BreakBeforeTernaryOperators: false
  14. # BreakConstructorInitializersBeforeComma: true
  15. IndentCaseLabels: true
  16. MaxEmptyLinesToKeep: 3
  17. AccessModifierOffset: -4
  18. IndentWidth: 4
  19. TabWidth: 4
  20. UseTab: Always
  21. BreakBeforeBraces: Allman
  22. SpaceAfterCStyleCast: true
  23. ReflowComments: false
  24. # ForEachMacros: [ foreach ]
  25. ...
  26.  
  27. YAML
  28.  
  29. git ls-files --full-name :!scripts '*.cpp' '*.h' '*.inl' | parallel --quote -m clang-format -i
  30. git add -u :!.clang-format
  31. ruby -ryaml <<-RUBY
  32. config = YAML.load_file(".clang-format").merge("ReflowComments" => true)
  33. File.write(".clang-format",
  34. YAML.dump(config))
  35. RUBY
  36. git ls-files --full-name :!scripts '*.cpp' '*.h' '*.inl' | parallel --quote -m clang-format -i
  37. ruby -ryaml <<-RUBY
  38. config = YAML.load_file(".clang-format").merge("ReflowComments" => false)
  39. File.write(".clang-format",
  40. YAML.dump(config))
  41. RUBY
  42. git diff -- :!.clang-format > reflow.diff
  43. git checkout HEAD -- :!.clang-format
  44. }
  45.  
  46. _main "$@"
Add Comment
Please, Sign In to add comment