Skip to content

Commit

Permalink
command/format: Remove defunct "Plan" type and associated symbols
Browse files Browse the repository at this point in the history
This "Plan" type, along with the other types it directly or indirectly
embeds and the associated functions, are adaptations of the
flatmap-oriented plan renderer logic from Terraform 0.11 and prior.

The current diff rendering logic is in diff.go, and so the contents of the
plan.go file are defunct apart from the DiffActionSymbol function that
both implementations share. Therefore here we move DiffActionSymbol into
diff.go and then remove plan.go entirely, in the interests of dead code
removal.
  • Loading branch information
apparentlymart committed Nov 6, 2019
1 parent 9a62ab3 commit d0cbbb6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 306 deletions.
23 changes: 23 additions & 0 deletions command/format/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -1190,3 +1190,26 @@ func ctyNullBlockSetAsEmpty(in cty.Value) cty.Value {
// sets, so our result here is always a set.
return cty.SetValEmpty(in.Type().ElementType())
}

// DiffActionSymbol returns a string that, once passed through a
// colorstring.Colorize, will produce a result that can be written
// to a terminal to produce a symbol made of three printable
// characters, possibly interspersed with VT100 color codes.
func DiffActionSymbol(action plans.Action) string {
switch action {
case plans.DeleteThenCreate:
return "[red]-[reset]/[green]+[reset]"
case plans.CreateThenDelete:
return "[green]+[reset]/[red]-[reset]"
case plans.Create:
return " [green]+[reset]"
case plans.Delete:
return " [red]-[reset]"
case plans.Read:
return " [cyan]<=[reset]"
case plans.Update:
return " [yellow]~[reset]"
default:
return " ?"
}
}
306 changes: 0 additions & 306 deletions command/format/plan.go

This file was deleted.

0 comments on commit d0cbbb6

Please sign in to comment.