feat(output): implement --color (status coloring, aws-style)#22
Merged
Conversation
The --color flag was accepted, validated, and completed but did nothing. Wire it end-to-end: formatter.ColorEnabled resolves on/off/auto exactly like the AWS CLI (auto = stdout is a terminal and NO_COLOR is unset), and text/table output now colors recognized status values (ACTIVE/READY green, ERROR/FAILED red, CREATING/PENDING/UPDATING yellow). JSON output is never colored so it stays valid. Column widths are computed on the raw text, so ANSI codes don't break table alignment. Applied to both the VKS and vServer output paths. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--colorwas a no-op: registered, validated (v1.3.1), and tab-completed, but the value was never read and nothing in the CLI ever emitted color. This wires it end-to-end, mirroring the AWS CLI's--colorsemantics.Behavior
formatter.ColorEnabled(mode, w)resolves the flag exactly likeaws:on→ always coloroff→ neverauto(default) → only when stdout is a terminal andNO_COLORis unsetWhen enabled,
textandtableoutput color recognized status values:ACTIVE,READY,RUNNING,AVAILABLE,HEALTHY,SUCCEEDED,COMPLETEDCREATING,DELETING,UPDATING,UPGRADING,PENDING,PROVISIONING,RECONCILINGERROR,FAILED,UNHEALTHY,DEGRADEDjsonoutput is never colored (must stay valid JSON — also matches aws). Applied to both the VKS and vServer output paths.Notes
os.ModeCharDevice.Testing
ColorEnabled(on/off/auto + NO_COLOR), status coloring in table, no-color default, non-status left uncolored, alignment preserved.go vet ./...clean; fullgo test ./...passes; build clean.🤖 Generated with Claude Code