sphinx-click icon indicating copy to clipboard operation
sphinx-click copied to clipboard

Create a separate page for each command group

Open lefeverd opened this issue 10 months ago • 2 comments
trafficstars

Hello,

First of all thank you for the extension.
I have a CLI which consists of multiple groups, with subgroups, and commands (commands collection).

Currently, the generation of the documentation for a collection generates a single page.
Would it be possible to generate separate pages for each "root" level group ?

Here's a minimal example of a CLI application (testcli.py) :

import click


def setup_cli():
    root = click.Group()

    test = click.Group(name="test", short_help="test related commands")
    subtest = click.Group(name="subtest", short_help="subtest related commands")
    subtest.add_command(test_command)
    test.add_command(subtest)

    root.add_command(test)
    return root


@click.command()
def test_command():
    click.echo("Hello")


root = setup_cli()

if __name__ == "__main__":
    root()

And the index.rst :

.. click:: testcli:root
   :prog: test-cli
   :nested: full

Thank you, David

lefeverd avatar Jan 24 '25 10:01 lefeverd

@lefeverd, I'm running into the same requirements, did you ever get this figured out?

Thanks!

davner avatar Apr 21 '25 19:04 davner

@davner, not really no. And at the moment I don't really have time to look at the code unfortunately.

lefeverd avatar Apr 21 '25 19:04 lefeverd