Skip to content

Add a generated command reference to the documentation - #191

Open
mortezagk wants to merge 1 commit into
marbl:masterfrom
mortezagk:docs-command-reference
Open

mortezagk wants to merge 1 commit into
marbl:masterfrom
mortezagk:docs-command-reference

Conversation

@mortezagk

Copy link
Copy Markdown

Problem

There is no command reference in the documentation. mash.readthedocs.io explains concepts but never lists the subcommands or their options. The man pages do, but they were generated in 2019 and have drifted: mash-sketch.1 is missing -I, -C, -S and -M, and bounds and taxscreen are documented nowhere at all. conf.py also still reported version 2.0.

The cause is that option definitions live in C++ and were copied by hand into two other places, both of which fell behind.

Approach

doc/generate_commands.py parses the addOption/useOption calls in the Command subclass constructors and renders both outputs from that one source:

  • doc/sphinx/commands.rst — new reference page, added to the toctree
  • doc/man/mash*.1 — regenerated, plus new mash-bounds.1 and mash-taxscreen.1

It mirrors Command::print(), so the output matches mash <command> -h exactly.

This does not reintroduce asciidoctor. 7ccc985 removed that dependency deliberately, and the generated files stay committed, so building and installing still need no extra tools. The script only runs when a developer changes an option: make docs regenerates, make check-docs fails if the files are stale.

Verification

Checked against a binary built from this tree: all 84 options across the 8 commands match mash <command> -h exactly, in both outputs. Sphinx builds clean on 8.2.3 (what readthedocs uses) and 9.1.0; all 9 man pages pass groff -ww; the generator is idempotent.

11 of the 15 files are generated — only the script and four small edits are hand-written. Reviewers can confirm with python3 doc/generate_commands.py --check.

Note

  • The man page date is fixed rather than today's date, so regenerating produces no spurious diff. Happy to change that.

- add doc/generate_commands.py, which parses the Command constructors
- add doc/sphinx/commands.rst and the missing bounds/taxscreen man pages
- regenerate the other man pages, which had drifted since 2019
- read the docs version from version.h and add make docs/check-docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant