click-contrib / sphinx-click

A Sphinx plugin to automatically document click-based applications
MIT License
212 stars 57 forks source link

ENH allow for grouped documentation with CommandCollection #73

Closed tomMoral closed 3 years ago

tomMoral commented 3 years ago

While building a CLI with many different subcommands, I splitted them in groups and merged together using a CommandCollections. When documenting this CLI, I wanted to preserve this group structure. I ended up tweaking a bit the sphinx-click extension to show the groups in sources as sections, without breaking the API. See here for an example of the results obtained: https://517-227720375-gh.circle-artifacts.com/0/dev/cli.html#benchopt

I ported the code for this in this PR. Let me know if you think it might interest others, I can try to document this change and make a few examples if you think it is worth it :) Else, feel free to close this PR. It might be too specific to my use case.

stephenfin commented 3 years ago

Oh, I didn't know this existed. Docs are here for anyone interested. Given this is a native feature of click, I'd be happy to support this. Could you add some docs and tests to prove this out before I review it fully?

tomMoral commented 3 years ago

I did a quick pass on the doc and the tests:

stephenfin commented 3 years ago

Thanks!

tomMoral commented 3 years ago

Thanks a lot for the super fast review!