Skip to content

adding optional msg parameter to \cli\Progress\Bar::tick()#126

Merged
schlessera merged 3 commits intowp-cli:masterfrom
lf-jeremy:progress-bar-tick-message
Mar 12, 2018
Merged

adding optional msg parameter to \cli\Progress\Bar::tick()#126
schlessera merged 3 commits intowp-cli:masterfrom
lf-jeremy:progress-bar-tick-message

Conversation

@lf-jeremy
Copy link
Copy Markdown
Contributor

As discussed in #125

The tick method of \cli\Notify::tick() is augmented in its grandchild class, \cli\Progress\Bar to have an optional second parameter which updates its _message property. As items are processed, the message may be optionally changed to reflect the nature of the work being performed.

The current behavior of the progress bar suppresses any output until the first tick occurs. In use cases where the developer wishes to display the initial message and then alter it during the first tick, they should manually call the public display() method of the progress bar before work is performed and the tick occurs.

The use case of displaying a message describing work about to be performed would be better served by supplementing this updated tick() method with a setter for the _message property whereby the message is manually changed before work is performed, then the tick is used to increment progress separately.

@schlessera schlessera merged commit e4cb9fd into wp-cli:master Mar 12, 2018
@schlessera
Copy link
Copy Markdown
Member

Thanks for the pull request!

@schlessera schlessera added this to the 0.11.9 milestone Mar 12, 2018
@lf-jeremy
Copy link
Copy Markdown
Contributor Author

Thanks for your involvement, @schlessera. This probably calls for updating the progress bar documentation as well. Appreciate the collaboration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants