Skip to content

Commit 1c691ff

Browse files
committed
[Console] Document the option about progress bar starting points
1 parent 1724e35 commit 1c691ff

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

components/console/helpers/progressbar.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,22 @@ Instead of advancing the bar by a number of steps (with the
4646
you can also set the current progress by calling the
4747
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::setProgress` method.
4848

49+
If you are resuming long-standing tasks, it's useful to start drawing the progress
50+
bar at a certain point. Use the second optional argument of ``start()`` to set
51+
that starting point::
52+
53+
use Symfony\Component\Console\Helper\ProgressBar;
54+
55+
// creates a new progress bar (100 units)
56+
$progressBar = new ProgressBar($output, 100);
57+
58+
// displays the progress bar starting at 25 completed units
59+
$progressBar->start(null, 25);
60+
61+
.. versionadded:: 6.2
62+
63+
The option to start a progress bar at a certain point was introduced in Symfony 6.2.
64+
4965
.. tip::
5066

5167
If your platform doesn't support ANSI codes, updates to the progress

0 commit comments

Comments
 (0)