Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Console] Progress helper enhancements#7300

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
pkruithof wants to merge5 commits intosymfony:masterfrompkruithof:progress-helper-enhancements
Closed

[Console] Progress helper enhancements#7300

pkruithof wants to merge5 commits intosymfony:masterfrompkruithof:progress-helper-enhancements

Conversation

pkruithof
Copy link
Contributor

QA
Bug fix?no
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets~
LicenseMIT
Doc PR~

Two enhancements:

  1. The progress bar clears the current line before writing the current progress. This can cause some flickering in the terminal. I've modified the write method to append whitespace to the line to be written, so it matches the previous line's length.
  2. Added asetCurrent method to set the current progress. Rather than advancing by 1 or more steps, sometimes you want to just set the current state. For example if you are downloading a file, and a callback provides you with the current download status. A workaround for this could be to keep track of the previous event, calculate the difference, and advancing by the diff. But it's easier to just set the current progress.

Sidenotes:

  • Theoverwrite method copied documentation of the Output'swrite method. The difference is, the overwrite method does not handle an array of messages. I've updated the documentation for this.
  • The helper usesstrlen to calculate line lengths. This could cause a problem when using multibyte strings. I'd change it tomb_strlen, but I'm not sure if themb_string extension is required by Symfony.

@pborreli
Copy link
Contributor

did you test on Windows ?

@pkruithof
Copy link
ContributorAuthor

I don't have a Windows VM, is there an easy way to test on Windows?

@pborreli
Copy link
Contributor

I will test it ASAP

@pborreli
Copy link
Contributor

phpunit src\Symfony\Component\Console\Tests\Helper\ProgressHelperTest.phpPHPUnit 3.7.18 by Sebastian Bergmann.Configuration read from C:\Users\pascal\console\symfony\phpunit.xml.dist.........Time: 0 seconds, Memory: 4.50MbOK (9 tests, 11 assertions)

@fabpot
Copy link
Member

We do not require mbstring, but we use it optionally when available. Seehttps://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Application.php#L784-L794 for instance.

public function testMultiByteSupport()
{
if (!function_exists('mb_strlen') || (false === $encoding = mb_detect_encoding('■'))) {
$this->markTestIncomplete('The mbstring extension is needed for multi-byte support');
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the test be skipped instead?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

You're right, I'll update it.

@pkruithof
Copy link
ContributorAuthor

@fabpot is this good to merge? The failed Travis build seems to come from a different component.

@fabpot
Copy link
Member

I've submitted a doc change for this PR:symfony/symfony-docs#2342 and added a CHANGELOG entry

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@pkruithof@pborreli@fabpot@staabm

[8]ページ先頭

©2009-2025 Movatter.jp