Skip to content

docs: automate cli docs generation#144

Merged
AloizioMacedo merged 27 commits intocanonical:masterfrom
AloizioMacedo:incorporate-cli-introspection-new-docs
Apr 16, 2026
Merged

docs: automate cli docs generation#144
AloizioMacedo merged 27 commits intocanonical:masterfrom
AloizioMacedo:incorporate-cli-introspection-new-docs

Conversation

@AloizioMacedo
Copy link
Copy Markdown
Contributor

Automates the CLI docs generation, similarly to how the API docs one is currently happening in the new docs.

@AloizioMacedo AloizioMacedo self-assigned this Apr 13, 2026
@AloizioMacedo AloizioMacedo added the documentation Improvements or additions to documentation label Apr 13, 2026
@AloizioMacedo AloizioMacedo requested a review from a team April 13, 2026 19:41
Copy link
Copy Markdown
Contributor

@MaikRe MaikRe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original introspection tool also contained test code.
While the new code seems functional and correct, moving it all to the sphinx extension loses the test code. Not sure if that is the best course of action.

Comment thread rtd-docs/_scripts/get_cli_spec.py Outdated
Comment thread rtd-docs/_scripts/generate_cli_docs.py Outdated
Comment thread rtd-docs/_ext/generate_cli_docs_extension.py Outdated
Comment thread rtd-docs/_scripts/generate_cli_docs.py Outdated
@AloizioMacedo
Copy link
Copy Markdown
Contributor Author

Thanks for the comments, @MaikRe ! Addressed them.

The original introspection tool also contained test code. While the new code seems functional and correct, moving it all to the sphinx extension loses the test code. Not sure if that is the best course of action.

Regarding this, which tests are you referring to?

@MaikRe
Copy link
Copy Markdown
Contributor

MaikRe commented Apr 15, 2026

Thanks for the comments, @MaikRe ! Addressed them.

The original introspection tool also contained test code. While the new code seems functional and correct, moving it all to the sphinx extension loses the test code. Not sure if that is the best course of action.

Regarding this, which tests are you referring to?

There are some minimal tests here: https://github.com/canonical/maas/blob/master/src/tests/docs/test_maas_cli_introspection.py

These tests will not work in this commit, but this
helps in separating the changes for reviewing and
understanding the diffs.
Avoids creating unused named variables.
normalize_text does not insert <br>'s anymore,
as that was intended for HTML and not markdown,
and header #'s were changed for linting reasons.
Extracts it and makes it less dependant on the relative
position. Assumes the root is the first parent
that is tracked as a git repo.
@AloizioMacedo AloizioMacedo force-pushed the incorporate-cli-introspection-new-docs branch from dbe5533 to 587a57a Compare April 15, 2026 22:02
@AloizioMacedo AloizioMacedo force-pushed the incorporate-cli-introspection-new-docs branch from 587a57a to 8474da4 Compare April 15, 2026 22:20
@AloizioMacedo
Copy link
Copy Markdown
Contributor Author

There are some minimal tests here: https://github.com/canonical/maas/blob/master/src/tests/docs/test_maas_cli_introspection.py

Thanks for the pointer! I brought them with some adaptations and incorporated them into the docs checks CI. There are things we could improve in them, but I believe they are out of the scope of this PR.

Copy link
Copy Markdown
Contributor

@MaikRe MaikRe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@AloizioMacedo AloizioMacedo added this pull request to the merge queue Apr 16, 2026
Merged via the queue into canonical:master with commit b90210e Apr 16, 2026
7 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants