Skip to content

Add Color Progress Output Mode#1384

Open
nrthakur wants to merge 2 commits intoapple:mainfrom
nrthakur:nik/feat/color-progress-output-mode
Open

Add Color Progress Output Mode#1384
nrthakur wants to merge 2 commits intoapple:mainfrom
nrthakur:nik/feat/color-progress-output-mode

Conversation

@nrthakur
Copy link
Copy Markdown
Contributor

@nrthakur nrthakur commented Apr 3, 2026

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Color Progress Output Mode

Adds a color progress output mode (--progress color) that renders ANSI-colored progress output with visual differentiation between progress states.

Unlike the existing ansi mode (which only uses cursor control), color introduces color-coded output:

  • Cyan → spinner / active tasks
  • Bold text → task description
  • Yellow / Green → percentage (in-progress / complete)
  • Green → progress bar
  • Dim text → secondary information

Like ansi mode, this feature requires a TTY.

Closes #1366

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

@nrthakur
Copy link
Copy Markdown
Contributor Author

nrthakur commented Apr 3, 2026

@jglogan PR 2/2 for the Color/Plain Progress Output Mode set (following #1365). I think this is in a good place now would appreciate some eyes when there is a free moment.

-cc @dkovba (since you approved the Plain PR #1367 & have some context)

Thank you both for all the help and support!

p.s - as a Canadian, the way you guys spell colour trips me out 😛

@jglogan jglogan requested a review from dkovba April 3, 2026 22:29
@github-actions github-actions bot added documentation Improvements or additions to documentation cli labels Apr 3, 2026
@jglogan
Copy link
Copy Markdown
Contributor

jglogan commented Apr 3, 2026

the way you guys spell colour trips me out

What is this "colour" you speak of

@jglogan
Copy link
Copy Markdown
Contributor

jglogan commented Apr 3, 2026

make fmt needed (consider installing the pre-commit hook)

Copy link
Copy Markdown
Contributor

@dkovba dkovba left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution! @jglogan Please check whether the use of colors matches your expectations. Do we expect to use the color mode by default?

totalTasks: totalTasks,
clearOnFinish: !isPlain,
outputMode: isPlain ? .plain : .ansi
outputMode: isPlain ? .plain : (progress == .color ? .color : .ansi)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Consider splitting the nested ternary operator into two parts or, better, using a switch statement.

// The render() method sets terminating based on outputMode
// For non-plain modes, it's "\r"
// We verify this indirectly: color mode is not plain
XCTAssertNotEqual(config.outputMode, .plain)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this test meaningful? Consider checking the actual terminator instead.

if config.showProgressBar, total > 0, allowProgress {
let usedWidth = components.joined(separator: " ").count + 45
let joinedComponents = components.joined(separator: " ")
let usedWidth = (useColor ? joinedComponents.visibleLength : joinedComponents.count) + 45
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be nice to add a comment explaining the value of 45.

@dkovba dkovba requested a review from jglogan April 4, 2026 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Request]: Add color progress mode

3 participants