Commit f7592d2
authored
Replace nwidger/jsoncolor with an in-tree colorizer (#5170)
## Changes
Drop `github.com/nwidger/jsoncolor` and replace `fancyJSON` with a small
in-tree colorizer over `json.MarshalIndent` output. Same ANSI palette as
before (green strings, cyan numbers, bold-green `true`, red `false`,
magenta `null`, bold-blue keys). `defaultRenderer.renderJson` now gates
colorization on cmdio TTY/color capabilities; `pretty_json` template
helper stays on `!color.NoColor` for parity with the other helpers in
`renderFuncMap`.
## Why
`fancyJSON` was the last caller of `nwidger/jsoncolor`, and it was the
only thing forcing `fatih/color.Color` values across a package boundary.
Removing it unblocks a future `fatih/color` migration and replaces the
incidental "color is off because fatih's package init saw stdout isn't a
TTY" gating with explicit cmdio capability checks.
## Tests
- Unit tests in `libs/cmdio/jsoncolor_test.go` cover
string/number/literal tokens, escape sequences, key vs value, empty
containers, and a round-trip property test (stripping ANSI yields the
original bytes).
- Manual smoke: `databricks current-user me -o json` on a TTY shows the
same colors as before; piped or `NO_COLOR=1` produces plain JSON.
_PR description drafted with Claude Code._1 parent 3ab8eb9 commit f7592d2
68 files changed
Lines changed: 1061 additions & 698 deletions
File tree
- acceptance
- apps/deploy
- bundle-with-appname
- no-bundle-with-appname
- auth
- credentials
- basic
- oauth
- pat
- host-metadata-cache
- bundle
- deployment
- bind
- job
- noop-job
- python-job
- quality-monitor
- unbind
- job
- python-job
- generate
- app_not_yet_deployed
- dashboard-inplace
- migrate/runas
- resource_deps
- jobs_update
- pipelines_recreate
- resources
- apps/create_already_exists
- clusters/deploy
- update-and-resize-autoscale
- update-and-resize
- dashboards/unpublish-out-of-band
- model_serving_endpoints/recreate/route-optimized
- permissions
- jobs
- added_remotely
- deleted_remotely
- update
- pipelines/update
- pipelines
- recreate-keys
- change-ingestion-definition
- change-storage
- update
- postgres_projects/recreate
- quality_monitors/change_table_name
- schemas/recreate
- secret_scopes/basic
- vector_search_endpoints/drift
- budget_policy
- min_qps
- volumes
- change-comment
- change-name
- remote-change-name
- run
- inline-script/databricks-cli/profile-is-passed/from_flag
- scripts
- basic
- databricks-cli/profile-is-passed/from_flag
- cmd
- auth/profiles
- spog-account
- workspace
- apps
- database/update-database-instance
- pipelines/e2e
- selftest
- IsServicePrincipal
- kill_caller
- multi_pattern
- multiple
- workspace
- jobs/create
- lakeview/publish
- repos
- create_with_provider
- create_without_provider
- delete_by_path
- update
- libs/cmdio
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | 158 | | |
163 | 159 | | |
164 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
4 | 4 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
4 | 4 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
4 | 4 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
Lines changed: 12 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
Lines changed: 13 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
0 commit comments