Skip to content

Documentation: Automatically generate CLI documentation#130

Merged
jnareb merged 4 commits into
mainfrom
documentation
May 30, 2025
Merged

Documentation: Automatically generate CLI documentation#130
jnareb merged 4 commits into
mainfrom
documentation

Conversation

@jnareb
Copy link
Copy Markdown
Member

@jnareb jnareb commented May 30, 2025

Use 'gen-files' MkDocs plugin to automatically generate reference documentation for CLI tools with mkdocs-typer2, similar to how this plugin is used to automatically generate reference API documentation with mkdocstrings.

While at it, fix generating CLI documentation for diffinsights-web (this is an independent change).

jnareb added 4 commits May 30, 2025 17:24
This directory contains automatically generated API reference, created
with 'gen-files' plugin (for the use by 'literate-nav' plugin).

Because there will be CLI reference (i.e. command line tools manpages),
rename it from docs/reference/ to docs/api_reference/
This change prepares for automatically generating reference
documentation for CLI tools, in addition to this script automatically
generating API documentation.
The new scripts/gen_cli_ref_pages.py gen-files script assumes that
the project is using pyproject.toml to declare (and install) CLI tools.
Extracting data from pyproject.toml means that the script should work
whether 'patchscope' project is installed or not.

This change required adjusting links in docs/cli.md, as now documentation
for each CLI tool is on separate page.

Hook(s) in scripts/my_hooks.py had to be adjusted to ignore generated
documentation for CLI, just like they were ignoring generated
documentation for API.

Add cli_reference/ to docs/.gitignore, so one can test the gen-files
script by running it with `python scripts/gen_cli_ref_pages.py`.
This Unicode character was the reason why mkdocs-typer2 (or the Markdown
renderer used by MkDocs) had problems rendering generated documentation
for the `diffinsights-web` CLI tool.
@jnareb jnareb self-assigned this May 30, 2025
@jnareb jnareb added documentation Improvements or additions to documentation enhancement New feature or request labels May 30, 2025
@dagshub
Copy link
Copy Markdown

dagshub Bot commented May 30, 2025

@github-actions
Copy link
Copy Markdown

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/diffannotator
   __init__.py00100% 
   annotate.py82313683%52, 75–76, 85, 92, 108–111, 113–115, 117, 446–447, 451–452, 454, 505, 507–509, 511, 513–515, 517–518, 520–522, 631, 634, 637–638, 693, 870, 906, 959–961, 965, 1005, 1086, 1354, 1368–1371, 1373, 1377–1380, 1382, 1562, 1565, 1783, 1785, 1832, 1857–1858, 1967, 1970, 2110–2111, 2113, 2138, 2189–2190, 2209–2210, 2213, 2228, 2243–2244, 2285, 2354, 2365, 2391, 2401, 2403, 2412–2416, 2420–2424, 2426, 2461, 2557, 2571, 2573–2574, 2576–2578, 2580, 2582–2584, 2586–2587, 2589, 2591, 2605, 2608, 2623–2625, 2631, 2644, 2653, 2661, 2664, 2734, 2740, 2742–2743, 2756, 2765–2770, 2884–2885, 2888–2889, 2893, 2938
   config.py50786%55–59, 61, 104
   gather_data.py3445384%61, 87, 91, 93, 101, 106, 108, 121, 129, 162, 240–241, 244–245, 248, 251, 262, 280–286, 318–319, 342–343, 366, 390, 415–416, 618, 622, 655, 790, 803, 805, 808, 812, 814, 852, 882–883, 949, 1001, 1187, 1219–1223, 1227
   generate_patches.py38392%102, 104, 126
   languages.py1011684%178, 181, 184, 187, 190, 194, 225–226, 238, 257, 269, 271–272, 275, 281, 319
   lexer.py29293%102–103
src/diffannotator/utils
   __init__.py00100% 
   git.py4878582%118, 269, 359, 361, 364–365, 367, 369–372, 374–376, 378–380, 385–386, 390, 392–393, 397–399, 401–402, 404–405, 407–408, 410, 532–533, 536, 585, 595, 598–600, 606, 637, 641, 648, 680, 693, 756, 843, 898, 905, 935, 939, 943, 990, 992, 1003, 1008, 1013, 1112–1113, 1175–1177, 1180–1181, 1224, 1228, 1305, 1310, 1312, 1315–1316, 1318, 1391–1392, 1525, 1527, 1555–1556, 1568, 1570, 1587–1588, 1628, 1642
TOTAL187230283% 

Tests Skipped Failures Errors Time
81 8 💤 0 ❌ 0 🔥 11.171s ⏱️

@jnareb jnareb merged commit 53673bb into main May 30, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant