Debian Codegraph @

README

raw
1 NAME
2 Progress::Any::Output::TermProgressBarColor - Output progress to
3 terminal as color bar
4
5 VERSION
6 This document describes version 0.249 of
7 Progress::Any::Output::TermProgressBarColor (from Perl distribution
8 Progress-Any-Output-TermProgressBarColor), released on 2020-08-15.
9
10 SYNOPSIS
11 use Progress::Any::Output;
12
13 # use default options
14 Progress::Any::Output->set('TermProgressBarColor');
15
16 # set options
17 Progress::Any::Output->set('TermProgressBarColor',
18 width=>50, fh=>\*STDERR, show_delay=>5);
19
20 DESCRIPTION
21 THIS IS AN EARLY RELEASE, SOME THINGS ARE NOT YET IMPLEMENTED E.G.
22 STYLES, COLOR THEMES.
23
24 Sample screenshots:
25
26 This output displays progress indicators as colored progress bar on
27 terminal. It produces output similar to that produced by
28 Term::ProgressBar, except that it uses the Progress::Any framework and
29 has additional features:
30
31 * colors and color themes
32
33 * template and styles
34
35 * displaying message text in addition to bar/percentage number
36
37 * wide character support
38
39 XXX option to cleanup when complete or not (like in Term::ProgressBar)
40 and should default to 1.
41
42 METHODS
43 new(%args) => OBJ
44 Instantiate. Usually called through
45 "Progress::Any::Output->set("TermProgressBarColor", %args)".
46
47 Known arguments:
48
49 * freq => num
50
51 Limit the frequency of output updating. 0 means no frequency
52 limiting (update output after every "update()").
53
54 A positive number means to update output when there has been that
55 amount of difference in position since last "update()". For example,
56 if "freq" is 10 and the last "update()" was at position 5, then the
57 next output update will be when position is at least 15.
58
59 A negative number means to update output when time has passed that
60 amount of absolute value (in seconds). For example, if "freq" is -3
61 and the last "update()" was 1 second ago, then the next output
62 update will not be until the next two seconds has passed.
63
64 By default undef, in which case Progress::Any will use the default
65 -0.5 (at most once every 0.5 seconds).
66
67 * wide => bool
68
69 If set to 1, enable wide character support (requires
70 Text::ANSI::WideUtil.
71
72 * width => INT
73
74 Width of progress bar. The default is to detect terminal width and
75 use the whole width.
76
77 * color_theme => STR
78
79 Not yet implemented.
80
81 Choose color theme. To see what color themes are available, use
82 "list_color_themes()".
83
84 * style => STR
85
86 Not yet implemented.
87
88 Choose style. To see what styles are available, use "list_styles()".
89 Styles determine the characters used for drawing the bar, alignment,
90 etc.
91
92 * template => str
93
94 See fill_template in Progress::Any's documentation. Aside from
95 conversions supported by Progress::Any, this output recognizes these
96 additional conversions: %b to display the progress bar (with width
97 using the rest of the available width), %B to display the progress
98 bar as well as the message inside it. You can also enclose parts of
99 text with "<color RGB>" ... "</color>" to give color.
100
101 The default template is:
102
103 <color ffff00>%p</color> <color 808000>[</color>%B<color 808000>]</color><color ffff00>%e</color>
104
105 * fh => handle (default: \*STDERR)
106
107 Instead of the default STDERR, you can direct the output to another
108 filehandle e.g. STDOUT.
109
110 * show_delay => int
111
112 If set, will delay showing the progress bar until the specified
113 number of seconds. This can be used to create, e.g. a CLI
114 application that is relatively not chatty but will display progress
115 after several seconds of seeming inactivity to indicate users that
116 the process is still going on.
117
118 * rownum => uint
119
120 Default 0. Can be set to put the progress bar at certain rownum.
121 This can be used to display several progress bars together.
122
123 keep_delay_showing()
124 Can be called to reset the timer that counts down to show progress bar
125 when "show_delay" is defined. For example, if "show_delay" is 5 seconds
126 and two seconds have passed, it should've been 3 seconds before progress
127 bar is shown in the next "update()". However, if you call this method,
128 it will be 5 seconds again before showing.
129
130 FAQ
131 How to update progress bar output more often?
132 Set "freq" to e.g. -0.1 or -0.05. The default "freq", when unset, is
133 -0.5 which means to update output at most once every 0.5 second.
134
135 How to display a different message for this output?
136 For example, this output formats message using String::Elide::Parts so
137 inside the message, substrings can be tagged for eliding priority:
138
139 <elspan prio=2>Downloading </elspan><elspan prio=3 truncate=middle>http://127.0.0.1:7007/2.mp4 </elspan>37.3M/139.5M
140
141 while another output like Progress::Any::Output::TermMessage does not
142 use String::Elide::Parts. It should just display the string as:
143
144 Downloading http://127.0.0.1:7007/2.mp4 37.3M/139.5M
145
146 In the indicator, you can provide a specific message for this output:
147
148 $progress->update(
149 message => 'Downloading http://127.0.0.1:7007/2.mp4 37.3M/139.5M',
150 'message.alt.output.TermProgressBarColor' => '<elspan prio=2>Downloading </elspan><elspan prio=3 truncate=middle>http://127.0.0.1:7007/2.mp4 </elspan>37.3M/139.5M',
151 ...
152 );
153
154 ENVIRONMENT
155 NO_COLOR
156 Bool. Can be used to disable color. Consulted before NO_COLOR. See
157 Color::ANSI::Util.
158
159 COLOR
160 Bool. Can be used to force or disable color. See Color::ANSI::Util.
161
162 COLOR_DEPTH
163 Integer. Can be used to override color depth detection. See
164 Color::ANSI::Util.
165
166 COLUMNS
167 Integer. Can be used to override terminal width detection.
168
169 PROGRESS_TERM_BAR
170 Bool. Forces disabling or enabling progress output (just for this
171 output).
172
173 In the absence of PROGRESS_TERM_MESSAGE and PROGRESS, will default to 1
174 if filehandle is detected as interactive (using "-t").
175
176 PROGRESS
177 Bool. Forces disabling or enabling progress output (for all outputs).
178
179 HOMEPAGE
180 Please visit the project's homepage at
181 <https://metacpan.org/release/Progress-Any-Output-TermProgressBarColor>.
182
183 SOURCE
184 Source repository is at
185 <https://github.com/perlancar/perl-Progress-Any-Output-TermProgressBarCo
186 lor>.
187
188 BUGS
189 Please report any bugs or feature requests on the bugtracker website
190 <https://rt.cpan.org/Public/Dist/Display.html?Name=Progress-Any-Output-T
191 ermProgressBarColor>
192
193 When submitting a bug or request, please include a test-file or a patch
194 to an existing test-file that illustrates the bug or desired feature.
195
196 SEE ALSO
197 Progress::Any
198
199 Term::ProgressBar
200
201 Ruby library: ruby-progressbar,
202 <https://github.com/jfelchner/ruby-progressbar>
203
204 AUTHOR
205 perlancar <[email protected]>
206
207 COPYRIGHT AND LICENSE
208 This software is copyright (c) 2020, 2018, 2017, 2016, 2015, 2014, 2013
209 by [email protected].
210
211 This is free software; you can redistribute it and/or modify it under
212 the same terms as the Perl 5 programming language system itself.
213