Skip to content

Commit 9a5946c

Browse files
committed
[clang-format] Add --directory option to dump_format_help.py
1 parent 94fbe7e commit 9a5946c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

clang/docs/tools/dump_format_help.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# A tool to parse the output of `clang-format --help` and update the
33
# documentation in ../ClangFormat.rst automatically.
44

5+
import argparse
56
import os
67
import re
78
import subprocess
@@ -26,7 +27,7 @@ def indent(text, columns, indent_first_line=True):
2627

2728

2829
def get_help_output():
29-
args = ["clang-format", "--help"]
30+
args = [binary, "--help"]
3031
cmd = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
3132
out, _ = cmd.communicate()
3233
out = out.decode(sys.stdout.encoding)
@@ -54,6 +55,14 @@ def validate(text, columns):
5455
print("warning: line too long:\n", line, file=sys.stderr)
5556

5657

58+
p = argparse.ArgumentParser()
59+
p.add_argument("-d", "--directory", help="directory of clang-format")
60+
opts = p.parse_args()
61+
62+
binary = "clang-format"
63+
if opts.directory:
64+
binary = opts.directory + "/" + binary
65+
5766
help_text = get_help_text()
5867
validate(help_text, 100)
5968

0 commit comments

Comments
 (0)