From 242cfe3f774e8a41d0b27d4664247f58d0a8d039 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 22 Aug 2025 16:19:19 +0200 Subject: tools: docs: parse_data_structs.py: add methods to return output When running it from command line, we want to write an output file, but when used as a class, one may just want the output content returned as a string. Split write_output() on two methods to allow both usecases. Also add an extra method to produce a TOC. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet Link: https://lore.kernel.org/r/c98bdec3380aad54178baf2751a2f1fcd128576b.1755872208.git.mchehab+huawei@kernel.org --- tools/docs/parse-headers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tools/docs/parse-headers.py') diff --git a/tools/docs/parse-headers.py b/tools/docs/parse-headers.py index 07d3b47c4834..bfa4e46a53e3 100755 --- a/tools/docs/parse-headers.py +++ b/tools/docs/parse-headers.py @@ -36,6 +36,9 @@ def main(): parser.add_argument("-d", "--debug", action="count", default=0, help="Increase debug level. Can be used multiple times") + parser.add_argument("-t", "--toc", action="store_true", + help="instead of a literal block, outputs a TOC table at the RST file") + parser.add_argument("file_in", help="Input C file") parser.add_argument("file_out", help="Output RST file") parser.add_argument("file_rules", nargs="?", @@ -50,7 +53,7 @@ def main(): parser.process_exceptions(args.file_rules) parser.debug_print() - parser.write_output(args.file_in, args.file_out) + parser.write_output(args.file_in, args.file_out, args.toc) if __name__ == "__main__": -- cgit