Skip to content

Add format customization and step-based progress display to Bar#196

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/add-step-progress-format
Draft

Add format customization and step-based progress display to Bar#196
Copilot wants to merge 6 commits intomainfrom
copilot/add-step-progress-format

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

Plan to Add Step-Based Progress Format Support

  • Modify Bar constructor to accept optional format parameters
  • Add current and total placeholders to the display() method
  • Ensure backward compatibility (default behavior unchanged)
  • Create tests to validate the new functionality
  • Run existing tests to ensure no regressions
  • Validate the changes with a manual test script
  • Fix code style issues (trailing whitespace)
  • Add example demonstrating the new functionality
  • Run code review
  • Run full test suite
  • Fix off-by-one errors in example loops
  • Add current, total, and percent placeholders to formatTiming and format
Original prompt

This section details on the original issue you should resolve

<issue_title>Cannot display step-based progress with format alone</issue_title>
<issue_description>## The Problem
Sometimes, it could be necessary to display not the percentage of the progress, but how many steps are completed out of a total. For example, something like this:

5/10 [==============================>                              ] 0:00 / 0:00

Instead of something like this:

50% [==============================>                              ] 0:00 / 0:00

Currently, this is not possible without overriding the Bar class.

Possible Cause

  1. The constructor of Bar, declared in Progress, does not accept a format parameter.
  2. The placeholders passed to Streams::render() do not include the _current and _total values.

Suggested Solution

  1. Accept a format argument in the constructor.
  2. Pass the necessary values of the respective members for _current and _total.

Remarks

What about other formats, like timing? Should they also be accepted as parameters?

Comments on the Issue (you are @copilot in this section)

@danielbachhuber > * Accept a format argument in the constructor. > > * Pass the necessary values of the respective members for `_current` and `_total`.

This seems reasonable. Want to put together a pull request for it?</comment_new>
<comment_new>@danielbachhuber

should we accept an argument for all of the formats? Because there are more.

I think we should only start with those that we need. We can always iterate later.</comment_new>
<comment_new>@schlessera
I actually think it would make more sense to not add to the number of arguments, but just provide a different implementation in your own code if you have special needs. I don't see anything inherently wrong with replacing the Bar class with your own StepBasedBar implementation.

Is there a specific reason why you would want to avoid that?</comment_new>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 4, 2026 02:05
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Add step-based progress display to Bar class Add format customization and step-based progress display to Bar Feb 4, 2026
Copilot AI requested a review from swissspidy February 4, 2026 02:08
@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 0% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/cli/progress/Bar.php 0.00% 13 Missing ⚠️

📢 Thoughts on this report? Let us know!

This comment was marked as resolved.

swissspidy and others added 2 commits February 3, 2026 22:19
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
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.

Cannot display step-based progress with format alone

2 participants