Skip to content

Commit

Permalink
Use os.chdir for qmk docs instead of a custom HTTP request handler (q…
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark authored and drashna committed Nov 29, 2019
1 parent c0dbd81 commit fb02593
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/python/qmk/cli/docs.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
"""Serve QMK documentation locally
"""
import http.server
import os

from milc import cli


class DocsHandler(http.server.SimpleHTTPRequestHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, directory='docs', **kwargs)


@cli.argument('-p', '--port', default=8936, type=int, help='Port number to use.')
@cli.subcommand('Run a local webserver for QMK documentation.')
def docs(cli):
"""Spin up a local HTTPServer instance for the QMK docs.
"""
with http.server.HTTPServer(('', cli.config.docs.port), DocsHandler) as httpd:
os.chdir('docs')

with http.server.HTTPServer(('', cli.config.docs.port), http.server.SimpleHTTPRequestHandler) as httpd:
cli.log.info("Serving QMK docs at http://localhost:%d/", cli.config.docs.port)
cli.log.info("Press Control+C to exit.")

Expand Down

0 comments on commit fb02593

Please sign in to comment.