Skip to content
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

No way to reset start time in helper BaseConsole::showProgress #1293

Closed
sergebezborodov opened this issue Nov 22, 2013 · 1 comment
Closed

No way to reset start time in helper BaseConsole::showProgress #1293

sergebezborodov opened this issue Nov 22, 2013 · 1 comment
Assignees
Labels
Milestone

Comments

@sergebezborodov
Copy link
Contributor

@sergebezborodov sergebezborodov commented Nov 22, 2013

Hi

My console app have several long time operations which i show with Console::showProgress. But it uses internal static var $start.

It is no way to reset it for next operations.

@ghost ghost assigned cebe Nov 22, 2013
@cebe cebe closed this in be911e1 Dec 11, 2013
@cebe
Copy link
Member

@cebe cebe commented Dec 11, 2013

Created a better implementation with three methods:

Usage:

Console::startProgress(0, 1000);
for ($n = 0; $n <= 1000; $n++) {
    usleep(10000);
    Console::updateProgress($n, 1000);
}
Console::endProgress();
[=====>                                                ] 14% (140/1000) ETA: 12 sec.

A git clone like progress is also possible:

Console::startProgress(0, 1000, 'Counting objects: ', false);
for ($n = 0; $n <= 1000; $n++) {
    usleep(10000);
    Console::updateProgress($n, 1000);
}
Console::endProgress('done.' . PHP_EOL);
Counting objects: 14% (140/1000) ETA: 12 sec.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.