click_extra.cli moduleΒΆ

The click-extra CLI.

Its commands are the terminal demos, the CLI wrapper, and the documentation and testing utilities.

click_extra.cli.DEMO_EPILOG = "\x08\nExamples:\n\n\x08\n  Run any Click CLI through Click Extra's colored help:\n    $ click-extra wrap -- my-cli --help\n\n\x08\n  Draw that help screen as a picture a README can show:\n    $ click-extra screenshot --output my-cli.svg -- my-cli --help\n\n\x08\n  Report the parameters a CLI accepts, and where each value comes from:\n    $ click-extra wrap --params -- my-cli\n\n\x08\n  Highlight a source file as a themed picture:\n    $ click-extra snippet --output basket.svg basket.py\n\n\x08\n  See how a help screen reads under each built-in theme:\n    $ click-extra themes\n"ΒΆ

Sample invocations closing the root help screen. Each \b escape is Click’s marker for a paragraph to keep as written, since the help formatter rewraps an epilog into one block otherwise.

click_extra.cli.LAZY_SUBCOMMANDS: dict[str, LazySubcommand] = {'prebake': LazySubcommand(import_path='click_extra.cli_prebake.prebake', section=None, fallback_to_default_section=True, short_help='Pre-bake build-time metadata into Python source files.'), 'screenshot': LazySubcommand(import_path='click_extra.cli_capture.screenshot_cmd', section=None, fallback_to_default_section=True, short_help="Capture a command's colored output and write it as an image or HTML."), 'snippet': LazySubcommand(import_path='click_extra.cli_capture.snippet_cmd', section=None, fallback_to_default_section=True, short_help='Highlight a source file and write it as an image or HTML.')}ΒΆ

The subcommands imported only when a run reaches them.

The capture commands pull the recording and drawing machinery in, and prebake its source rewriting, which no other run of the CLI needs. Each declares the first paragraph of its help, so the root help screen lists it without importing it. A Nuitka build sees no import of these modules, so [tool.nuitka] of pyproject.toml includes each by name.

click_extra.cli.TEST_SUITE_EPILOG = '\x08\nExamples:\n\n\x08\n  Run the built-in default suite against a CLI:\n    $ click-extra test-suite --command my-cli\n\n\x08\n  Run the cases a file declares, one at a time, stopping on the first failure:\n    $ click-extra test-suite --command my-cli --suite-file cases.yaml --jobs 1 --exit-on-error\n\n\x08\n  Run two of them, skipping the cases a platform cannot answer:\n    $ click-extra test-suite --command my-cli --select-test 3 --select-test 7 --skip-platform windows\n'ΒΆ

Sample invocations closing the test-suite help screen.

click_extra.cli.REFRESH_DIRECTIVES_EPILOG = '\x08\nExamples:\n\n\x08\n  Refresh every self-updating block of a documentation tree:\n    $ click-extra refresh-directives docs\n\n\x08\n  Refresh one page:\n    $ click-extra refresh-directives docs/recipes.md\n\n\x08\n  Report the stale ones without writing, for a continuous-integration job:\n    $ click-extra refresh-directives --check docs\n'ΒΆ

Sample invocations closing the refresh-directives help screen.

click_extra.cli.CONVERT_TO_MYST_EPILOG = '\x08\nExamples:\n\n\x08\n  Convert the docstrings of the package in the current directory:\n    $ click-extra convert-to-myst\n\n\x08\n  Convert the docstrings under another one:\n    $ click-extra convert-to-myst src/basket\n'ΒΆ

Sample invocations closing the convert-to-myst help screen.