Skip to content

Commit 411df3b

Browse files
committed
[clang-format] Make command lines of dump_format_[style|help].py consistent
1 parent 9a415f6 commit 411df3b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

clang/docs/tools/dump_format_style.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# documentation in ../ClangFormatStyleOptions.rst automatically.
44
# Run from the directory in which this file is located to update the docs.
55

6+
import argparse
67
import inspect
78
import os
89
import re
@@ -474,6 +475,10 @@ class State:
474475
return options
475476

476477

478+
p = argparse.ArgumentParser()
479+
p.add_argument("-o", "--output", help="path of output file")
480+
args = p.parse_args()
481+
477482
with open(FORMAT_STYLE_FILE) as f:
478483
opts = OptionsReader(f).read_options()
479484
with open(INCLUDE_STYLE_FILE) as f:
@@ -487,6 +492,5 @@ class State:
487492

488493
contents = substitute(contents, "FORMAT_STYLE_OPTIONS", options_text)
489494

490-
output_file_path = sys.argv[1] if len(sys.argv) == 2 else DOC_FILE
491-
with open(output_file_path, "wb") as output:
495+
with open(args.output if args.output else DOC_FILE, "wb") as output:
492496
output.write(contents.encode())

clang/test/Format/docs_updated.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %python %S/../../docs/tools/dump_format_style.py %t.style
1+
// RUN: %python %S/../../docs/tools/dump_format_style.py -o %t.style
22
// RUN: diff %t.style %S/../../docs/ClangFormatStyleOptions.rst
33

44
// RUN: %python %S/../../docs/tools/dump_format_help.py -o %t.help

0 commit comments

Comments
 (0)