Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- set -e -u
- _main() {
- cat > .clang-format <<YAML
- ---
- Language: Cpp
- BasedOnStyle: Google
- AllowShortFunctionsOnASingleLine: None
- AlwaysBreakAfterDefinitionReturnType: true
- BreakBeforeBinaryOperators: None
- # BreakBeforeTernaryOperators: false
- # BreakConstructorInitializersBeforeComma: true
- IndentCaseLabels: true
- MaxEmptyLinesToKeep: 3
- AccessModifierOffset: -4
- IndentWidth: 4
- TabWidth: 4
- UseTab: Always
- BreakBeforeBraces: Allman
- SpaceAfterCStyleCast: true
- ReflowComments: false
- # ForEachMacros: [ foreach ]
- ...
- YAML
- git ls-files --full-name :!scripts '*.cpp' '*.h' '*.inl' | parallel --quote -m clang-format -i
- git add -u :!.clang-format
- ruby -ryaml <<-RUBY
- config = YAML.load_file(".clang-format").merge("ReflowComments" => true)
- File.write(".clang-format",
- YAML.dump(config))
- RUBY
- git ls-files --full-name :!scripts '*.cpp' '*.h' '*.inl' | parallel --quote -m clang-format -i
- ruby -ryaml <<-RUBY
- config = YAML.load_file(".clang-format").merge("ReflowComments" => false)
- File.write(".clang-format",
- YAML.dump(config))
- RUBY
- git diff -- :!.clang-format > reflow.diff
- git checkout HEAD -- :!.clang-format
- }
- _main "$@"
Add Comment
Please, Sign In to add comment