[docs] Automatically generate CLI documentation #16851
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Command-line usage information was previously only available to users
who had successfully installed wptrunner. Consuming the information in
that form (e.g. navigating between sub-commands, scrolling through pages
of content and searching for keywords) also required some proficiency
with the command-line.
Extend the documentation build process to include this information in
the project website. This makes it easier to consume for those with
limited experience using the command-line, and in particular, it adds
the content to the data indexed by the website's "search" feature.
Because this content is generated from the state of the interface, it
avoids the need to maintain documentation separately.
This is implemented via a new code path that eagerly load wptrunner's
complete command-line interface. The new
create_complete_parser
isconsumed by the
sphinx-argparse
module to produce the rendereddocumentation.
Previously discussed in bocoup/wpt-docs#12
The wptrunner CLI is built lazily based on the subcommand being executed. Even then, the task of argument parsing is split across unrelated
argparse
instances. These two details resist documentation generation (at least in the terms expected by thesphinx-argparse
module).Facilitating this work required an artificial code path. I'm sensitive to creating branches that aren't used by contributors, but given the small size of the new function, I think the documentation may be valuable enough to justify the maintenance burden.
Here's what the new page looks like:
Like any other content on the Sphinx-powered site, it is indexed by the client-side "search" feature.
And the user's query is highlighted on the page itself