Skip to content

fix: use VT100 box-drawing characters and semantic colors for output - #124

Open
rsnodgrass wants to merge 1 commit into
dineshba:mainfrom
rsnodgrass:fix/box-drawing-chars
Open

fix: use VT100 box-drawing characters and semantic colors for output#124
rsnodgrass wants to merge 1 commit into
dineshba:mainfrom
rsnodgrass:fix/box-drawing-chars

Conversation

@rsnodgrass

@rsnodgrass rsnodgrass commented May 9, 2026

Copy link
Copy Markdown

Summary

  • Replace ASCII |--- and | with VT100 box-drawing characters (├──, └──, ) in tree output for crisp rendering
  • Fix tree continuation lines: last siblings now use └── and omit the vertical bar below terminal nodes
  • Add space after tree connectors and before action suffixes (name (+) instead of name(+)) for readability
  • Table output uses box-drawing characters (, , ) instead of +, -, | for non-markdown mode
  • Add semantic colors to table rows: green (add), red (delete), yellow (update), magenta (recreate), cyan (import/moved)
  • Colors respect NO_COLOR env via the fatih/color library (already a dependency)
  • Markdown output unchanged

Before / After

Tree

Before:

|---github_repository
|       |---terraform_plan_summary(+)
|---module
|       |---github["demo-repository"]
|       |       |---github_branch

After:

├── github_repository
│   └── terraform_plan_summary (+)
└── module
    └── github["demo-repository"]
        ├── github_branch

Table

Before:

+------------+---------------------------+
|   CHANGE   |         RESOURCE          |
+------------+---------------------------+
| add (1)    | aws_instance.example1     |
+------------+---------------------------+

After (with semantic colors):

┼────────────┼───────────────────────────┼
│   CHANGE   │         RESOURCE          │
┼────────────┼───────────────────────────┼
│ add (1)    │ aws_instance.example1     │  ← green
┼────────────┼───────────────────────────┼
│ delete (1) │ aws_instance.example2     │  ← red
┼────────────┼───────────────────────────┼
graph LR
    A[writer/tree.go] -->|"├── └── │"| B[Crisp tree lines]
    C[writer/table.go] -->|"│ ─ ┼ + Rich()"| D[Box-drawing + colors]
    E[tree/tree.go] -->|"AddChild spacing"| F[Drawable tree spacing]
    B --> G[Better terminal output]
    D --> G
    F --> G
Loading

Test plan

  • All existing tests updated and passing (go test ./...)
  • Verify tree output in terminal with a real Terraform plan
  • Verify table output renders correctly with colors in terminal
  • Confirm markdown output is unaffected
  • Verify NO_COLOR=1 disables table colors

Co-Authored-By: SageOx ox@sageox.ai

@rsnodgrass
rsnodgrass force-pushed the fix/box-drawing-chars branch from bfce31f to 1a2aa07 Compare May 9, 2026 03:43
Replace ASCII pipes and dashes with the original VT100 box-drawing
characters (├, └, │, ─, ┼) for crisp tree and table rendering.

Tree output now correctly uses └── for last siblings and omits the
vertical continuation line below terminal nodes. Added a space after
the connector and before action suffixes for readability.

Table output uses semantic colors per action type (green for add,
red for delete, yellow for update, magenta for recreate, cyan for
import/moved) via tablewriter Rich() API. Colors automatically
respect NO_COLOR via the fatih/color library.

Co-Authored-By: SageOx <ox@sageox.ai>
@rsnodgrass
rsnodgrass force-pushed the fix/box-drawing-chars branch from 1a2aa07 to 60b52fc Compare May 9, 2026 03:50
@rsnodgrass rsnodgrass changed the title fix: use VT100 box-drawing characters for tree and table output fix: use VT100 box-drawing characters and semantic colors for output May 9, 2026
@rsnodgrass
rsnodgrass marked this pull request as ready for review May 9, 2026 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant