logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

docs.py (1001B)


  1. """Serve QMK documentation locally
  2. """
  3. import shutil
  4. from qmk.docs import prepare_docs_build_area, run_docs_command
  5. from milc import cli
  6. @cli.argument('-p', '--port', default=8936, type=int, help='Port number to use.')
  7. @cli.argument('-b', '--browser', action='store_true', help='Open the docs in the default browser.')
  8. @cli.subcommand('Run a local webserver for QMK documentation.', hidden=False if cli.config.user.developer else True)
  9. def docs(cli):
  10. """Spin up a local HTTP server for the QMK docs.
  11. """
  12. if not shutil.which('doxygen'):
  13. cli.log.error('doxygen is not installed. Please install it and try again.')
  14. return
  15. if not shutil.which('yarn'):
  16. cli.log.error('yarn is not installed. Please install it and try again.')
  17. return
  18. if not prepare_docs_build_area(is_production=False):
  19. return False
  20. cmd = ['docs:dev', '--port', f'{cli.args.port}']
  21. if cli.args.browser:
  22. cmd.append('--open')
  23. run_docs_command('run', cmd)