Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Click sub-command name renaming not detected #74

Open
@Querela

Description

@Querela

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 (module modA.cli in package packageA)
  • in another package (module modB.cli in package packageB) I also have a CLI and import the group main from modA.cli as submain
  • I add the submain group to the modB.cli command groups as a subcommand.
    If I now execute packageB I will see the subcommand submain as possible choice. In the generated documentation it however will still appear as main (name from modA.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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions