Skip to content

Commit

Permalink
deploy: c2f6e48
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeldycke committed Feb 2, 2025
0 parents commit f1c1c47
Show file tree
Hide file tree
Showing 139 changed files with 70,366 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 3d483dc14313dfd58bb9d7a7ff0ec365
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file added .doctrees/changelog.doctree
Binary file not shown.
Binary file added .doctrees/click_extra.doctree
Binary file not shown.
Binary file added .doctrees/code-of-conduct.doctree
Binary file not shown.
Binary file added .doctrees/colorize.doctree
Binary file not shown.
Binary file added .doctrees/commands.doctree
Binary file not shown.
Binary file added .doctrees/config.doctree
Binary file not shown.
Binary file added .doctrees/environment.pickle
Binary file not shown.
Binary file added .doctrees/index.doctree
Binary file not shown.
Binary file added .doctrees/install.doctree
Binary file not shown.
Binary file added .doctrees/issues.doctree
Binary file not shown.
Binary file added .doctrees/license.doctree
Binary file not shown.
Binary file added .doctrees/logging.doctree
Binary file not shown.
Binary file added .doctrees/parameters.doctree
Binary file not shown.
Binary file added .doctrees/pygments.doctree
Binary file not shown.
Binary file added .doctrees/pytest.doctree
Binary file not shown.
Binary file added .doctrees/sphinx.doctree
Binary file not shown.
Binary file added .doctrees/tabulate.doctree
Binary file not shown.
Binary file added .doctrees/testing.doctree
Binary file not shown.
Binary file added .doctrees/tests.doctree
Binary file not shown.
Binary file added .doctrees/timer.doctree
Binary file not shown.
Binary file added .doctrees/todolist.doctree
Binary file not shown.
Binary file added .doctrees/tutorial.doctree
Binary file not shown.
Binary file added .doctrees/version.doctree
Binary file not shown.
Empty file added .nojekyll
Empty file.
3,522 changes: 3,522 additions & 0 deletions _modules/click/core.html

Large diffs are not rendered by default.

932 changes: 932 additions & 0 deletions _modules/click/decorators.html

Large diffs are not rendered by default.

693 changes: 693 additions & 0 deletions _modules/click/exceptions.html

Large diffs are not rendered by default.

653 changes: 653 additions & 0 deletions _modules/click/formatting.html

Large diffs are not rendered by default.

892 changes: 892 additions & 0 deletions _modules/click/parser.html

Large diffs are not rendered by default.

1,169 changes: 1,169 additions & 0 deletions _modules/click/termui.html

Large diffs are not rendered by default.

1,541 changes: 1,541 additions & 0 deletions _modules/click/types.html

Large diffs are not rendered by default.

991 changes: 991 additions & 0 deletions _modules/click/utils.html

Large diffs are not rendered by default.

1,201 changes: 1,201 additions & 0 deletions _modules/click_extra/colorize.html

Large diffs are not rendered by default.

787 changes: 787 additions & 0 deletions _modules/click_extra/commands.html

Large diffs are not rendered by default.

798 changes: 798 additions & 0 deletions _modules/click_extra/config.html

Large diffs are not rendered by default.

479 changes: 479 additions & 0 deletions _modules/click_extra/decorators.html

Large diffs are not rendered by default.

482 changes: 482 additions & 0 deletions _modules/click_extra/docs_update.html

Large diffs are not rendered by default.

977 changes: 977 additions & 0 deletions _modules/click_extra/logging.html

Large diffs are not rendered by default.

1,153 changes: 1,153 additions & 0 deletions _modules/click_extra/parameters.html

Large diffs are not rendered by default.

577 changes: 577 additions & 0 deletions _modules/click_extra/pygments.html

Large diffs are not rendered by default.

699 changes: 699 additions & 0 deletions _modules/click_extra/pytest.html

Large diffs are not rendered by default.

496 changes: 496 additions & 0 deletions _modules/click_extra/sphinx.html

Large diffs are not rendered by default.

558 changes: 558 additions & 0 deletions _modules/click_extra/tabulate.html

Large diffs are not rendered by default.

437 changes: 437 additions & 0 deletions _modules/click_extra/telemetry.html

Large diffs are not rendered by default.

1,060 changes: 1,060 additions & 0 deletions _modules/click_extra/testing.html

Large diffs are not rendered by default.

440 changes: 440 additions & 0 deletions _modules/click_extra/timer.html

Large diffs are not rendered by default.

828 changes: 828 additions & 0 deletions _modules/click_extra/version.html

Large diffs are not rendered by default.

1,168 changes: 1,168 additions & 0 deletions _modules/cloup/_commands.html

Large diffs are not rendered by default.

631 changes: 631 additions & 0 deletions _modules/cloup/_context.html

Large diffs are not rendered by default.

773 changes: 773 additions & 0 deletions _modules/cloup/_option_groups.html

Large diffs are not rendered by default.

425 changes: 425 additions & 0 deletions _modules/cloup/_params.html

Large diffs are not rendered by default.

649 changes: 649 additions & 0 deletions _modules/cloup/_sections.html

Large diffs are not rendered by default.

600 changes: 600 additions & 0 deletions _modules/cloup/constraints/_support.html

Large diffs are not rendered by default.

810 changes: 810 additions & 0 deletions _modules/cloup/formatting/_formatter.html

Large diffs are not rendered by default.

577 changes: 577 additions & 0 deletions _modules/cloup/styling.html

Large diffs are not rendered by default.

407 changes: 407 additions & 0 deletions _modules/cloup/types.html

Large diffs are not rendered by default.

1,355 changes: 1,355 additions & 0 deletions _modules/functools.html

Large diffs are not rendered by default.

383 changes: 383 additions & 0 deletions _modules/index.html

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions _sources/changelog.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
```{include} ../changelog.md
```
130 changes: 130 additions & 0 deletions _sources/click_extra.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
click\_extra package
====================

.. automodule:: click_extra
:members:
:undoc-members:
:show-inheritance:

Submodules
----------

click\_extra.colorize module
----------------------------

.. automodule:: click_extra.colorize
:members:
:undoc-members:
:show-inheritance:

click\_extra.commands module
----------------------------

.. automodule:: click_extra.commands
:members:
:undoc-members:
:show-inheritance:

click\_extra.config module
--------------------------

.. automodule:: click_extra.config
:members:
:undoc-members:
:show-inheritance:

click\_extra.decorators module
------------------------------

.. automodule:: click_extra.decorators
:members:
:undoc-members:
:show-inheritance:

click\_extra.docs\_update module
--------------------------------

.. automodule:: click_extra.docs_update
:members:
:undoc-members:
:show-inheritance:

click\_extra.logging module
---------------------------

.. automodule:: click_extra.logging
:members:
:undoc-members:
:show-inheritance:

click\_extra.parameters module
------------------------------

.. automodule:: click_extra.parameters
:members:
:undoc-members:
:show-inheritance:

click\_extra.pygments module
----------------------------

.. automodule:: click_extra.pygments
:members:
:undoc-members:
:show-inheritance:

click\_extra.pytest module
--------------------------

.. automodule:: click_extra.pytest
:members:
:undoc-members:
:show-inheritance:

click\_extra.sphinx module
--------------------------

.. automodule:: click_extra.sphinx
:members:
:undoc-members:
:show-inheritance:

click\_extra.tabulate module
----------------------------

.. automodule:: click_extra.tabulate
:members:
:undoc-members:
:show-inheritance:

click\_extra.telemetry module
-----------------------------

.. automodule:: click_extra.telemetry
:members:
:undoc-members:
:show-inheritance:

click\_extra.testing module
---------------------------

.. automodule:: click_extra.testing
:members:
:undoc-members:
:show-inheritance:

click\_extra.timer module
-------------------------

.. automodule:: click_extra.timer
:members:
:undoc-members:
:show-inheritance:

click\_extra.version module
---------------------------

.. automodule:: click_extra.version
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions _sources/code-of-conduct.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Code of conduct

```{include} ../.github/code-of-conduct.md
---
start-line: 2
---
```
148 changes: 148 additions & 0 deletions _sources/colorize.md.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# Colored help

Extend
[Cloup's own help formatter and theme](https://cloup.readthedocs.io/en/stable/pages/formatting.html#help-formatting-and-themes)
to add colorization of:

- Options

- Choices

- Metavars

- Cli name

- Sub-commands

- Command aliases

- Long and short options

- Choices

- Metavars

- Environment variables

- Defaults

```{todo}
Write examples and tutorial.
```

## Why not use `rich-click`?

[`rich-click`](https://github.com/ewels/rich-click) is a good project that aims to integrate [Rich](https://github.com/Textualize/rich) with Click. Like Click Extra, it provides a ready-to-use help formatter for Click.

But contrary to Click Extra, the [help screen is rendered within a table](https://github.com/ewels/rich-click#styling), which takes the whole width of the terminal. This is not ideal if you try to print the output of a command somewhere else.

The typical use-case is users reporting issues on GitHub, and pasting the output of a command in the issue description. If the output is too wide, it will be akwardly wrapped, or [adds a horizontal scrollbar](https://github.com/callowayproject/bump-my-version/pull/23#issuecomment-1602007874) to the page.

Without a table imposing a maximal width, the help screens from Click Extra will be rendered with the minimal width of the text, and will be more readable.

```{hint}
This is just a matter of preference, as nothing prevents you to use both `rich-click` and Click Extra in the same project, and get the best from both.
```

## `color_option`

```{todo}
Write examples and tutorial.
```

## `help_option`

```{todo}
Write examples and tutorial.
```

## Colors and styles

Here is a little CLI to demonstrate the rendering of colors and styles, based on [`cloup.styling.Style`](https://cloup.readthedocs.io/en/stable/autoapi/cloup/styling/index.html#cloup.styling.Style):

```{eval-rst}
.. click:example::
from click import command
from click_extra import Color, style, Choice, option
from click_extra.tabulate import render_table

all_styles = [
"bold",
"dim",
"underline",
"overline",
"italic",
"blink",
"reverse",
"strikethrough",
]

all_colors = sorted(Color._dict.values())

@command
@option("--matrix", type=Choice(["colors", "styles"]))
def render_matrix(matrix):
table = []

if matrix == "colors":
table_headers = ["Foreground ↴ \ Background →"] + all_colors
for fg_color in all_colors:
line = [
style(fg_color, fg=fg_color)
]
for bg_color in all_colors:
line.append(
style(fg_color, fg=fg_color, bg=bg_color)
)
table.append(line)

elif matrix == "styles":
table_headers = ["Color ↴ \ Style →"] + all_styles
for color_name in all_colors:
line = [
style(color_name, fg=color_name)
]
for prop in all_styles:
line.append(
style(color_name, fg=color_name, **{prop: True})
)
table.append(line)

render_table(table, headers=table_headers)

.. click:run::
result = invoke(render_matrix, ["--matrix=colors"])
assert "\x1b[95mbright_magenta\x1b[0m" in result.stdout
assert "\x1b[95m\x1b[101mbright_magenta\x1b[0m" in result.stdout

.. click:run::
result = invoke(render_matrix, ["--matrix=styles"])
assert "\x1b[97mbright_white\x1b[0m" in result.stdout
assert "\x1b[97m\x1b[1mbright_white\x1b[0m" in result.stdout
assert "\x1b[97m\x1b[2mbright_white\x1b[0m" in result.stdout
assert "\x1b[97m\x1b[4mbright_white\x1b[0m" in result.stdout
```

```{caution}
The current rendering of colors and styles in this HTML documentation is not complete, and does not reflect the real output in a terminal.

That is because [`pygments-ansi-color`](https://github.com/chriskuehl/pygments-ansi-color), the component we rely on to render ANSI code in Sphinx via Pygments, [only supports a subset of the ANSI codes](https://github.com/chriskuehl/pygments-ansi-color/issues/31) we use.
```

```{tip}
The code above is presented as a CLI, so you can copy and run it yourself in your environment, and see the output in your terminal. That way you can evaluate the real effect of these styles and colors for your end users.
```

## `click_extra.colorize` API

```{eval-rst}
.. autoclasstree:: click_extra.colorize
:strict:
```

```{eval-rst}
.. automodule:: click_extra.colorize
:members:
:undoc-members:
:show-inheritance:
```
Loading

0 comments on commit f1c1c47

Please sign in to comment.