Skip to content

Commit b557615

Browse files
author
Liam Cervante
authored
Migrate 'state show' command to new renderer (#33116)
* Migrate 'state show' command to new renderer * handle error
1 parent f0b3b74 commit b557615

File tree

9 files changed

+120
-9802
lines changed

9 files changed

+120
-9802
lines changed

internal/command/format/diff.go

Lines changed: 0 additions & 2063 deletions
This file was deleted.

internal/command/format/diff_test.go

Lines changed: 0 additions & 7007 deletions
This file was deleted.

internal/command/format/difflanguage_string.go

Lines changed: 0 additions & 29 deletions
This file was deleted.

internal/command/format/format.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,30 @@
66
// output formatting as much as possible so that text formats of Terraform
77
// structures have a consistent look and feel.
88
package format
9+
10+
import "github.com/hashicorp/terraform/internal/plans"
11+
12+
// DiffActionSymbol returns a string that, once passed through a
13+
// colorstring.Colorize, will produce a result that can be written
14+
// to a terminal to produce a symbol made of three printable
15+
// characters, possibly interspersed with VT100 color codes.
16+
func DiffActionSymbol(action plans.Action) string {
17+
switch action {
18+
case plans.DeleteThenCreate:
19+
return "[red]-[reset]/[green]+[reset]"
20+
case plans.CreateThenDelete:
21+
return "[green]+[reset]/[red]-[reset]"
22+
case plans.Create:
23+
return " [green]+[reset]"
24+
case plans.Delete:
25+
return " [red]-[reset]"
26+
case plans.Read:
27+
return " [cyan]<=[reset]"
28+
case plans.Update:
29+
return " [yellow]~[reset]"
30+
case plans.NoOp:
31+
return " "
32+
default:
33+
return " ?"
34+
}
35+
}

internal/command/format/state.go

Lines changed: 0 additions & 216 deletions
This file was deleted.

0 commit comments

Comments
 (0)