Conversation
|
@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 😛 |
What is this "colour" you speak of |
|
|
| totalTasks: totalTasks, | ||
| clearOnFinish: !isPlain, | ||
| outputMode: isPlain ? .plain : .ansi | ||
| outputMode: isPlain ? .plain : (progress == .color ? .color : .ansi) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
It would be nice to add a comment explaining the value of 45.
Type of Change
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
ansimode (which only uses cursor control),colorintroduces color-coded output:Like
ansimode, this feature requires a TTY.Closes #1366
Testing