Skip to content
Myr

Merge branch 'pr/95'

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

authored by Armin Ronacher · committed by Armin Ronacher · parents 32ba5e7, 7af94e8 · Browse files · 3 files+11 added−11 removed
This commit

State

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

Diff stats

3 files+11 added−11 removed

  • other:+11 added−11 removed

3 files+11 added−11 removed

modified:click/termui.py+5 added-5 removed
193 unmodified lines
194195 The context manager creates the progress bar. When the context196 manager is entered the progress bar is already displayed. With every197 iteration over the progress bar the iterable passed to the bar is198 advanced and the bar is updated. When the context manager is exited198 advanced and the bar is updated. When the context manager exits199 a newline is printed and the progress bar is finalized on screen.200201 No printing must happen or the progress bar will be unintentionally202 destroyed.
8 unmodified lines
211212 :param iterable: an iterable to iterate over. If not provided the length213 is required.214 :param length: the number of items to iterate over. By default the215 progressbar will attempt to ask the iterator about it's216 length with might or might not work. If an iterable is215 progressbar will attempt to ask the iterator about its216 length, which might or might not work. If an iterable is217 also provided this parameter can be used to override the218 length. If an iterable is not provided the progress bar219 will iterate over a range of that length.220 :param label: the label to show next to the progress bar.
3 unmodified lines
224 :param show_percent: enables or disables the percentage display. The225 default is `True` if the iterable has a length or226 `False` if not.227 :param show_pos: enables or disables the absolute position display. The228 deafult is `False`.228 default is `False`.229 :param item_show_func: a function called with the current item which230 can return a string to show the current item231 next to the progress bar. Note that the current232 item can be `None`!233 :param fill_char: the character to use to show the filled part of the234 progress bar.235 :param empty_char: the character to use to show the non filled part of235 :param empty_char: the character to use to show the non-filled part of236 the progress bar.237 :param bar_template: the format string to use as template for the bar.238 The parameters in it are ``label`` for the label,239 ``bar`` for the progress bar and ``info`` for the
13 unmodified lines
modified:click/utils.py+3 added-3 removed
203 unmodified lines
204 possible. This is a very carefree function as in that it will try its205 best to not fail.206207 In addition to that if `colorama`_ is installed the echo function will208 also support clever handling of ansi codes. Essentially it will then208 also support clever handling of ANSI codes. Essentially it will then209 do the following:210211 - add transparent handling of ANSI color codes on Windows211 - add transparent handling of ANSI color codes on Windows.212 - hide ANSI codes automatically if the destination file is not a213 terminal.214215 .. _colorama: http://pypi.python.org/pypi/colorama216217 .. versionchanged:: 2.0218 Starting with version 2.0 of Click, the echo function will work218 Starting with version 2.0 of click, the echo function will work219 with colorama if it's installed.220221 :param message: the message to print222 :param file: the file to write to (defaults to ``stdout``)
142 unmodified lines
modified:docs/utils.rst+3 added-3 removed
112 unmodified lines
113114.. versionadded:: 2.0115116Very often you want to open a config file that belongs to your117application. However different operationg systems store these config117application. However different operating systems store these config118files by their policy in different places. Click provides a119:func:`get_app_dir` function which returns the most appropriate location120for per user config files for your application depending on the OS.120for per-user config files for your application depending on the OS.121122Example usage::123124 import os
49 unmodified lines
174 for user in bar:175 modify_the_user(user)176177Another useful feature is to associate a label with the progress bar which178will be shown before next to the progress bar::178will be shown preceding the progress bar::179180 with click.progressbar(all_the_users_to_process,181 label='Modifying user accounts',182 length=number_of_users) as bar:
2 unmodified lines