File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 3131import sys
3232from distutils .spawn import find_executable
3333
34- binary = find_executable ('google-java-format' ) or '/usr/bin/google-java-format'
35-
3634def main ():
3735 parser = argparse .ArgumentParser (description =
3836 'Reformat changed lines in diff. Without -i '
@@ -55,6 +53,7 @@ def main():
5553 help = 'use AOSP style instead of Google Style (4-space indentation)' )
5654 parser .add_argument ('--skip-sorting-imports' , action = 'store_true' ,
5755 help = 'do not fix the import order' )
56+ parser .add_argument ('-b' , '--binary' , help = 'path to google-java-format binary' )
5857 args = parser .parse_args ()
5958
6059 # Extract changed lines for each file.
@@ -87,6 +86,11 @@ def main():
8786 lines_by_file .setdefault (filename , []).extend (
8887 ['-lines' , str (start_line ) + ':' + str (end_line )])
8988
89+ if args .binary :
90+ binary = args .binary
91+ else :
92+ binary = find_executable ('google-java-format' ) or '/usr/bin/google-java-format'
93+
9094 # Reformat files containing changes in place.
9195 for filename , lines in lines_by_file .iteritems ():
9296 if args .i and args .verbose :
You can’t perform that action at this time.
0 commit comments