terraform/internal/command/format
Billy Keyes 52ca30273f
command/format: improve list nested attribute rendering (#29827)
* command/format: fix list nested attr diff rendering

Previously, diffs only rendered correctly if all changed elements
appeared before all unchanged elements. Once an unchanged element was
found, all remaining elements were skipped. This usually led to the
output being an empty list with a weird amount of space between the
brackets.

* command/format: improve list nested attr rendering

This makes several changes that make diffs for lists clearer and more
consistent:

  * Separate items with brackets instead of only new lines. This better
    matches the input syntax and avoids confusion from the first and
    last brackets implying there is a single item.
  * Render an action symbol for each element of the list
  * Use the correct action symbol for new and deleted items
  * Fix the alignment of opening and closing brackets

I also refactored the structure so it is similar to the set and map
cases to minimize duplication of the new prints.

* Fix re-use of blockBodyDiffResult struct
2021-11-02 11:13:56 -04:00
..
diagnostic.go command/views/json: Never generate invalid diagnostic snippet offsets 2021-06-28 13:42:28 -07:00
diagnostic_test.go update to use typed sensitive marks 2021-06-25 12:49:07 -04:00
diff.go command/format: improve list nested attribute rendering (#29827) 2021-11-02 11:13:56 -04:00
diff_test.go command/format: improve list nested attribute rendering (#29827) 2021-11-02 11:13:56 -04:00
difflanguage_string.go cli: Refactor resource drift rendering 2021-09-16 15:22:37 -04:00
format.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00
object_id.go unmark object ID or Name for formatting 2021-08-17 12:24:43 -04:00
object_id_test.go unmark object ID or Name for formatting 2021-08-17 12:24:43 -04:00
state.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
state_test.go Move terraform/ to internal/terraform/ 2021-05-17 14:09:07 -07:00
trivia.go Move command/ to internal/command/ 2021-05-17 14:09:07 -07:00