Blame view

misc/maintenance/fix_cpplint_whitespace.sh 516 Bytes
8dcb6dfcb   Yannick Estève   first commit
1
2
3
4
5
6
7
8
9
10
11
12
  #!/bin/bash
  [ $# == 0 ] && echo "Usage: $0 src/[some-dir]/*.{h,cc}" && exit 1
  
  # Let's run a set of in-place modifications by sed-commands,
  for file in $@; do
    sed -i 's/; \/\//;  \/\//' $file # '; //' -> ';  //'
    sed -i 's/{ \/\//{  \/\//' $file # '{ //' -> '{  //'
    sed -i 's/} \/\//}  \/\//' $file # '} //' -> '}  //'
    sed -i 's/for(/for (/' $file     # 'for(' -> 'for ('
    sed -i 's/if(/if (/' $file       # 'if(' -> 'if ('
    sed -i 's/\s\s*$//' $file        # 'remove white-space at the end of lines'
  done