Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Autogeneration of the CLI documentation. #3268

Merged
merged 65 commits into from
Mar 10, 2025

Conversation

ruben-arts
Copy link
Contributor

@ruben-arts ruben-arts commented Mar 4, 2025

Why?

Decrease future maintainance of the documentation, making sure it's always in sync with the tool.

How?

This PR introduces another Rust binary called pixi_docs which can be executed.
As a result it will create all the CLI docs for the pixi commands.
These will be put in the docs/autogenerated folder.

Updating the documentation can be done manually in two ways.

  • Update the information wrapped in the clap commands in src/cli/<COMMAND>.rs
  • Add extra information with the injection through snippets. Documentation about this can be found in docs/reference/cli/README.md

This generation is fully based on the clap::Command, which is really cool options of the clap parser!

TODO

To get this MVP in we should have moved all current documentation over, making sure we're not missing example from the original docs/reference/cli.md.

  • Replace old documentation
  • Push generated docs into the repo
  • Create a CI stage that checks the generation

Out of scope of this PR

  • We're not extending the documentation
  • We're not adding groups to the options, this would make it easier to read the options for tools like pixi add
  • We're not focusing on improving the docstrings in the documentation, unless they are wrong.

@Hofer-Julian
Copy link
Contributor

Things that I noticed:

  • Website title is concatenated without spaces: e.g. pixiglobaluninstall
  • Many examples have broken lists: e.g. pixi global add
  • Options are not rendered as lists, they just have a - in front
  • Global & co should be a header in front of the option list instead of a prefix for each list element
  • If you look at pixi init, you'll find that flag parameters are sometimes lowercase --channel (-c) channel and sometimes uppercase --import (-i) ENV_FILE

Copy link
Contributor

@Hofer-Julian Hofer-Julian left a comment

Choose a reason for hiding this comment

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

Great work.

Would be nice to have a bit better reporting

@ruben-arts ruben-arts linked an issue Mar 6, 2025 that may be closed by this pull request
@ruben-arts ruben-arts marked this pull request as ready for review March 10, 2025 08:41
Copy link
Contributor

@Hofer-Julian Hofer-Julian left a comment

Choose a reason for hiding this comment

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

Awesome improvement! 📖

@ruben-arts ruben-arts enabled auto-merge (squash) March 10, 2025 08:43
@ruben-arts ruben-arts merged commit 4f231b4 into prefix-dev:main Mar 10, 2025
34 checks passed
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.

Autogenerated CLI documentation
3 participants