From c949b66674a8e625db0e75c522efce5597b42255 Mon Sep 17 00:00:00 2001 From: Jan Luebbe Date: Fri, 11 Jul 2014 20:51:58 +0200 Subject: Documentation: use command groups The help definition already contained a group declaration. This is now reused for the HTML documentation. Signed-off-by: Jan Luebbe Signed-off-by: Sascha Hauer --- Documentation/gen_commands.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'Documentation/gen_commands.py') diff --git a/Documentation/gen_commands.py b/Documentation/gen_commands.py index 4e33ccaea6..d3db350bf7 100755 --- a/Documentation/gen_commands.py +++ b/Documentation/gen_commands.py @@ -1,5 +1,6 @@ #!/usr/bin/python +import errno import os import re import sys @@ -76,7 +77,7 @@ def parse_c(name): x = CMD_GROUP.match(line) if x: last = cmd['c_group'] - last.append(x.group(1).decode("string_escape")) + last.append(x.group(1).split('_')[-1].lower()) continue x = CONT.match(line) if x: @@ -159,6 +160,14 @@ for name in CMDS.keys(): for name, cmd in CMDS.items(): #pprint({name: cmd}) rst = gen_rst(name, cmd) - target = os.path.join(sys.argv[2], name+'.rst') + subdir = os.path.join(sys.argv[2], cmd['c_group'][0]) + try: + os.makedirs(subdir) + except OSError as e: + if e.errno == errno.EEXIST and os.path.isdir(subdir): + pass + else: + raise + target = os.path.join(subdir, name+'.rst') file(target, 'w').write(rst) -- cgit v1.2.3