aboutsummaryrefslogtreecommitdiff
path: root/lib/python/qmk/cli/generate/docs.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/qmk/cli/generate/docs.py')
-rw-r--r--lib/python/qmk/cli/generate/docs.py37
1 files changed, 37 insertions, 0 deletions
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"""
3import shutil
4import subprocess
5from pathlib import Path
6
7from milc import cli
8
9DOCS_PATH = Path('docs/')
10BUILD_PATH = Path('.build/docs/')
11
12
13@cli.subcommand('Build QMK documentation.', hidden=False if cli.config.user.developer else True)
14def 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)