import sys
-# Change this to the full path if clang-format is not on the path.
-binary = 'clang-format'
-
-
def main():
parser = argparse.ArgumentParser(description=
'Reformat changed lines in diff. Without -i '
help='let clang-format sort include blocks')
parser.add_argument('-v', '--verbose', action='store_true',
help='be more verbose, ineffective without -i')
- parser.add_argument(
- '-style',
- help=
- 'formatting style to apply (LLVM, Google, Chromium, Mozilla, WebKit)')
+ parser.add_argument('-style',
+ help='formatting style to apply (LLVM, Google, Chromium, '
+ 'Mozilla, WebKit)')
+ parser.add_argument('-binary', default='clang-format',
+ help='location of binary to use for clang-format')
args = parser.parse_args()
# Extract changed lines for each file.
for filename, lines in lines_by_file.iteritems():
if args.i and args.verbose:
print 'Formatting', filename
- command = [binary, filename]
+ command = [args.binary, filename]
if args.i:
command.append('-i')
if args.sort_includes: