Skip to content

Document new progressbar methods #4655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions components/console/helpers/progressbar.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ number of units, and advance the progress as the command executes::
Instead of advancing the bar by a number of steps (with the
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::advance` method),
you can also set the current progress by calling the
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::setCurrent` method.
:method:`Symfony\\Component\\Console\\Helper\\ProgressBar::setProgress` method.

.. versionadded:: 2.6
The ``setProgress()`` method was introduced in Symfony 2.6. Previously it was
called ``setCurrent()``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we usually write something like "It was called setCurrent() prior to Symfony 2.6."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your proposal, so I've changed both message. Thanks!


.. caution::

Expand Down Expand Up @@ -300,10 +304,14 @@ that displays the number of remaining steps::
ProgressBar::setPlaceholderFormatterDefinition(
'remaining_steps',
function (ProgressBar $bar, OutputInterface $output) {
return $bar->getMaxSteps() - $bar->getStep();
return $bar->getMaxSteps() - $bar->getProgress();
}
);

.. versionadded:: 2.6
The ``getProgress()`` method was introduced in Symfony 2.6. Previously it was
called ``getStep()``.

Custom Messages
~~~~~~~~~~~~~~~

Expand Down