mirror of
https://github.com/qmk/qmk_firmware.git
synced 2026-02-09 09:32:14 +08:00
Some checks failed
Update API Data / api_data (push) Has been cancelled
CI Build Major Branch / Determine concurrency (push) Has been cancelled
CLI CI / test (push) Has been cancelled
Update feature branches after develop merge / feature_branch_update (riot) (push) Has been cancelled
Update feature branches after develop merge / feature_branch_update (xap) (push) Has been cancelled
Lint Format / lint (push) Has been cancelled
Regenerate Files / regen (push) Has been cancelled
Unit Tests / test (push) Has been cancelled
CI Build Major Branch / Compile keymap default (push) Has been cancelled
CI Build Major Branch / Consolidation (push) Has been cancelled
* `qmk docs`: restore `--port` and `--browser` arguments * Make docs command args always a list
31 lines
1001 B
Python
31 lines
1001 B
Python
"""Serve QMK documentation locally
|
|
"""
|
|
import shutil
|
|
from qmk.docs import prepare_docs_build_area, run_docs_command
|
|
|
|
from milc import cli
|
|
|
|
|
|
@cli.argument('-p', '--port', default=8936, type=int, help='Port number to use.')
|
|
@cli.argument('-b', '--browser', action='store_true', help='Open the docs in the default browser.')
|
|
@cli.subcommand('Run a local webserver for QMK documentation.', hidden=False if cli.config.user.developer else True)
|
|
def docs(cli):
|
|
"""Spin up a local HTTP server for the QMK docs.
|
|
"""
|
|
|
|
if not shutil.which('doxygen'):
|
|
cli.log.error('doxygen is not installed. Please install it and try again.')
|
|
return
|
|
|
|
if not shutil.which('yarn'):
|
|
cli.log.error('yarn is not installed. Please install it and try again.')
|
|
return
|
|
|
|
if not prepare_docs_build_area(is_production=False):
|
|
return False
|
|
|
|
cmd = ['docs:dev', '--port', f'{cli.args.port}']
|
|
if cli.args.browser:
|
|
cmd.append('--open')
|
|
run_docs_command('run', cmd)
|