diff options
| author | Ryan <fauxpark@gmail.com> | 2025-02-01 21:19:30 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-01 21:19:30 +1100 |
| commit | 273d8d6a1a6badb8d9b473954f16a0fbbe671987 (patch) | |
| tree | 0d2558d1d8ae2ce22c5b6702abc5315c607e2c12 /lib/python/qmk/cli | |
| parent | ff09b921f1c2160abe05c1fdbd38f25f64b6c7bd (diff) | |
`qmk docs`: restore `--port` and `--browser` arguments (#24623)
* `qmk docs`: restore `--port` and `--browser` arguments
* Make docs command args always a list
Diffstat (limited to 'lib/python/qmk/cli')
| -rw-r--r-- | lib/python/qmk/cli/docs.py | 9 | ||||
| -rw-r--r-- | lib/python/qmk/cli/generate/docs.py | 6 |
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/python/qmk/cli/docs.py b/lib/python/qmk/cli/docs.py index d28dddf194..da02ebf95e 100644 --- a/lib/python/qmk/cli/docs.py +++ b/lib/python/qmk/cli/docs.py | |||
| @@ -6,6 +6,8 @@ from qmk.docs import prepare_docs_build_area, run_docs_command | |||
| 6 | from milc import cli | 6 | from milc import cli |
| 7 | 7 | ||
| 8 | 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.') | ||
| 9 | @cli.subcommand('Run a local webserver for QMK documentation.', hidden=False if cli.config.user.developer else True) | 11 | @cli.subcommand('Run a local webserver for QMK documentation.', hidden=False if cli.config.user.developer else True) |
| 10 | def docs(cli): | 12 | def docs(cli): |
| 11 | """Spin up a local HTTP server for the QMK docs. | 13 | """Spin up a local HTTP server for the QMK docs. |
| @@ -22,6 +24,7 @@ def docs(cli): | |||
| 22 | if not prepare_docs_build_area(is_production=False): | 24 | if not prepare_docs_build_area(is_production=False): |
| 23 | return False | 25 | return False |
| 24 | 26 | ||
| 25 | if not cli.config.general.verbose: | 27 | cmd = ['docs:dev', '--port', f'{cli.args.port}'] |
| 26 | cli.log.info('Serving docs at http://localhost:5173/ (Ctrl+C to stop)') | 28 | if cli.args.browser: |
| 27 | run_docs_command('run', 'docs:dev') | 29 | cmd.append('--open') |
| 30 | run_docs_command('run', cmd) | ||
diff --git a/lib/python/qmk/cli/generate/docs.py b/lib/python/qmk/cli/generate/docs.py index 5821d43b86..7abeca9d2a 100644 --- a/lib/python/qmk/cli/generate/docs.py +++ b/lib/python/qmk/cli/generate/docs.py | |||
| @@ -27,10 +27,8 @@ def generate_docs(cli): | |||
| 27 | return False | 27 | return False |
| 28 | 28 | ||
| 29 | cli.log.info('Building vitepress docs') | 29 | cli.log.info('Building vitepress docs') |
| 30 | run_docs_command('run', 'docs:build') | 30 | run_docs_command('run', ['docs:build']) |
| 31 | cli.log.info('Successfully generated docs to %s.', BUILD_DOCS_PATH) | 31 | cli.log.info('Successfully generated docs to %s.', BUILD_DOCS_PATH) |
| 32 | 32 | ||
| 33 | if cli.args.serve: | 33 | if cli.args.serve: |
| 34 | if not cli.config.general.verbose: | 34 | run_docs_command('run', ['docs:preview']) |
| 35 | cli.log.info('Serving docs at http://localhost:4173/ (Ctrl+C to stop)') | ||
| 36 | run_docs_command('run', 'docs:preview') | ||
