diff options
Diffstat (limited to 'lib/python')
-rw-r--r-- | lib/python/qmk/cli/generate/__init__.py | 1 | ||||
-rw-r--r-- | lib/python/qmk/cli/generate/docs.py | 37 |
2 files changed, 38 insertions, 0 deletions
diff --git a/lib/python/qmk/cli/generate/__init__.py b/lib/python/qmk/cli/generate/__init__.py index 4dc7607ef..13bd1f091 100644 --- a/lib/python/qmk/cli/generate/__init__.py +++ b/lib/python/qmk/cli/generate/__init__.py | |||
@@ -1 +1,2 @@ | |||
1 | from . import api | 1 | from . import api |
2 | from . import docs | ||
diff --git a/lib/python/qmk/cli/generate/docs.py b/lib/python/qmk/cli/generate/docs.py new file mode 100644 index 000000000..a59a24db5 --- /dev/null +++ b/lib/python/qmk/cli/generate/docs.py | |||
@@ -0,0 +1,37 @@ | |||
1 | """Build QMK documentation locally | ||
2 | """ | ||
3 | import shutil | ||
4 | import subprocess | ||
5 | from pathlib import Path | ||
6 | |||
7 | from milc import cli | ||
8 | |||
9 | DOCS_PATH = Path('docs/') | ||
10 | BUILD_PATH = Path('.build/docs/') | ||
11 | |||
12 | |||
13 | @cli.subcommand('Build QMK documentation.', hidden=False if cli.config.user.developer else True) | ||
14 | def generate_docs(cli): | ||
15 | """Invoke the docs generation process | ||
16 | |||
17 | TODO(unclaimed): | ||
18 | * [ ] Add a real build step... something static docs | ||
19 | """ | ||
20 | |||
21 | if BUILD_PATH.exists(): | ||
22 | shutil.rmtree(BUILD_PATH) | ||
23 | |||
24 | shutil.copytree(DOCS_PATH, BUILD_PATH) | ||
25 | |||
26 | # When not verbose we want to hide all output | ||
27 | args = {'check': True} | ||
28 | if not cli.args.verbose: | ||
29 | args.update({'stdout': subprocess.DEVNULL, 'stderr': subprocess.STDOUT}) | ||
30 | |||
31 | cli.log.info('Generating internal docs...') | ||
32 | |||
33 | # Generate internal docs | ||
34 | subprocess.run(['doxygen', 'Doxyfile'], **args) | ||
35 | subprocess.run(['moxygen', '-q', '-a', '-g', '-o', BUILD_PATH / 'internals_%s.md', 'doxygen/xml'], **args) | ||
36 | |||
37 | cli.log.info('Successfully generated internal docs to %s.', BUILD_PATH) | ||