mkdocs / mkdocs-click

An MkDocs extension to generate documentation for Click command line applications
https://pypi.org/project/mkdocs-click
Apache License 2.0
109 stars 15 forks source link

Change CLI main command to arbitrary name #6

Closed rodrigoalmeida94 closed 3 years ago

rodrigoalmeida94 commented 4 years ago

Thanks a lot for this package! We are implementing in our SDK docs and it's working great.

We have, however, a small issue that we believe you could help with. In the setup.py in our package we use:

entry_points="""
        [console_scripts]
        up42=up42.cli:main
    """

Which means that the main function of the up42/cli.py script is used as the entry point for the click CLI, but the main name gets replaced with the up42 name, so that you can call up42 authenticate instead of main authenticate. In the generated docs with mkdocs-click we see the main name instead, which can be confusing for users.

It would be great if we could somehow in the mkdocs-click setup add an entry_point, i.e.:

::: mkdocs-click
    :module: up42.cli
    :command: main
    :entry_point: up42
    :depth: 2

And then in the generated docs all the main references would be replaced with up42.

I believe this could be quite useful since a number of click CLIs are using mechanisms similar to this. Happy to hear any alternative suggestions/comments/questions you have!

AdrienFromToulouse commented 3 years ago

👋 @rodrigoalmeida94 I think you would just need to rename your main function to up42.

rodrigoalmeida94 commented 3 years ago

Hey @AdrienFromToulouse ! Quite right, talk about missing the simplest solution... Thanks for the help!