command/format: Use box drawing chars for rules in diagnostics

We were previously using some ASCII art to create some visual divisions
between parts of the diagnostic output. Now that we are requiring a UTF-8
terminal we can print out box drawing characters instead.
This commit is contained in:
Martin Atkins 2021-01-11 18:36:49 -08:00
parent e6a516d87e
commit 0c84a56700
2 changed files with 10 additions and 10 deletions

View File

@ -172,10 +172,10 @@ func Diagnostic(diag tfdiags.Diagnostic, sources map[string][]byte, color *color
sort.Strings(stmts) // FIXME: Should maybe use a traversal-aware sort that can sort numeric indexes properly? sort.Strings(stmts) // FIXME: Should maybe use a traversal-aware sort that can sort numeric indexes properly?
if len(stmts) > 0 { if len(stmts) > 0 {
fmt.Fprint(&buf, color.Color(" [dark_gray]|----------------[reset]\n")) fmt.Fprint(&buf, color.Color(" [dark_gray]├────────────────[reset]\n"))
} }
for _, stmt := range stmts { for _, stmt := range stmts {
fmt.Fprintf(&buf, color.Color(" [dark_gray]|[reset] %s\n"), stmt) fmt.Fprintf(&buf, color.Color(" [dark_gray][reset] %s\n"), stmt)
} }
} }

View File

@ -94,8 +94,8 @@ Whatever shall we do?
on test.tf line 1: on test.tf line 1:
1: test [underline]source[reset] code 1: test [underline]source[reset] code
[dark_gray]|----------------[reset] [dark_gray][reset]
[dark_gray]|[reset] [bold]boop.beep[reset] is "blah" [dark_gray][reset] [bold]boop.beep[reset] is "blah"
Whatever shall we do? Whatever shall we do?
`, `,
@ -127,8 +127,8 @@ Whatever shall we do?
on test.tf line 1: on test.tf line 1:
1: test [underline]source[reset] code 1: test [underline]source[reset] code
[dark_gray]|----------------[reset] [dark_gray][reset]
[dark_gray]|[reset] [bold]boop.beep[reset] has a sensitive value [dark_gray][reset] [bold]boop.beep[reset] has a sensitive value
Whatever shall we do? Whatever shall we do?
`, `,
@ -160,8 +160,8 @@ Whatever shall we do?
on test.tf line 1: on test.tf line 1:
1: test [underline]source[reset] code 1: test [underline]source[reset] code
[dark_gray]|----------------[reset] [dark_gray][reset]
[dark_gray]|[reset] [bold]boop.beep[reset] is a string, known only after apply [dark_gray][reset] [bold]boop.beep[reset] is a string, known only after apply
Whatever shall we do? Whatever shall we do?
`, `,
@ -193,8 +193,8 @@ Whatever shall we do?
on test.tf line 1: on test.tf line 1:
1: test [underline]source[reset] code 1: test [underline]source[reset] code
[dark_gray]|----------------[reset] [dark_gray][reset]
[dark_gray]|[reset] [bold]boop.beep[reset] will be known only after apply [dark_gray][reset] [bold]boop.beep[reset] will be known only after apply
Whatever shall we do? Whatever shall we do?
`, `,