Skip to content
Myr

Use `click.echo` everywhere in the docs, document exception

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Refs https://github.com/pallets/click/pull/3581#issuecomment-4903297318

authored by Kevin Deldycke · committed by Kevin Deldycke · parent 9f9b149 · Browse files · 1 file+8 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−1 removed

  • other:+8 added−1 removed

1 file+8 added−1 removed

modified:docs/utils.md+8 added-1 removed
126 unmodified lines
127 for idx in range(50000):128 print(idx, file=pager)129```130131```{hint} Why print instead of echo?132The pager object deals with ANSI color and style codes itself: they are kept or133stripped depending on what the pager supports, exactly as {func}`echo` would do.134Any code that writes to a file, including plain {func}`print`, can therefore be135used with it.136```137138## Screen Clearing139140```{versionadded} 2.0141```
247 unmodified lines
389import time390391with click.progressbar([1, 2, 3]) as bar:392 for x in bar:386 print(f"sleep({x})...")393 click.echo(f"sleep({x})...")394 time.sleep(x)395```396397Another useful feature is to associate a label with the progress bar which will be shown preceding the progress bar:
20 unmodified lines