command/format: Render null in dark gray (#19616)

This commit is contained in:
Radek Simko 2019-01-11 19:27:09 +00:00 committed by GitHub
parent c5ea0f7d9b
commit bc4b7cad68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -420,7 +420,7 @@ func (p *blockBodyDiffPrinter) writeValue(val cty.Value, action plans.Action, in
return
}
if val.IsNull() {
p.buf.WriteString("null")
p.buf.WriteString(p.color.Color("[dark_gray]null[reset]"))
return
}
@ -815,7 +815,11 @@ func (p *blockBodyDiffPrinter) writeValueDiff(old, new cty.Value, indent int, pa
// In all other cases, we just show the new and old values as-is
p.writeValue(old, plans.Delete, indent)
p.buf.WriteString(p.color.Color(" [yellow]->[reset] "))
if new.IsNull() {
p.buf.WriteString(p.color.Color(" [dark_gray]->[reset] "))
} else {
p.buf.WriteString(p.color.Color(" [yellow]->[reset] "))
}
p.writeValue(new, plans.Create, indent)
if p.pathForcesNewResource(path) {
p.buf.WriteString(p.color.Color(forcesNewResourceCaption))