Open
Description
Hi, I'm using the most current version of Sphinx (3.4.2), Sphinx-Click (latest) and click (7.1.2).
My situation is like this:
- I have a separate package with a click cli, which has a group named
main
(modulemodA.cli
in package packageA) - in another package (module
modB.cli
in package packageB) I also have a CLI and import the groupmain
frommodA.cli
assubmain
- I add the
submain
group to themodB.cli
command groups as a subcommand.
If I now executepackageB
I will see the subcommandsubmain
as possible choice. In the generated documentation it however will still appear asmain
(name frommodA.cli
I would suppose)
Not sure if the example code can reproduce this or if it has to be separate packages (not just modules)...
# packageA modA.cli
import click
@click.group()
def main():
pass
@main.group()
def subA():
pass
# packageB modB.cli
import click
from modA.cli import main as submain
@click.group()
def main():
pass
main.add_command(submain, "submain") # <-- here I add the commandgroup from packageB and rename the command
# without renaming here, it will show up as `main` in the CLI
@main.group()
def subB():
pass
I will then call the modB.cli:main()
entry point.
Documentation is dead simple:
.. click:: modB.cli:main
:prog: packageB
:nested: full