qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

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