Skip to content

Commit 6e2980f

Browse files
committed
fix: use semantic terraform test toasts
1 parent eac81e5 commit 6e2980f

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

cmd/terraform/test.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"github.com/cloudposse/atmos/pkg/flags"
1919
h "github.com/cloudposse/atmos/pkg/hooks"
2020
"github.com/cloudposse/atmos/pkg/ui"
21-
"github.com/cloudposse/atmos/pkg/ui/theme"
2221
)
2322

2423
// testParser handles flag parsing for the test command.
@@ -185,19 +184,26 @@ func formatTerraformTestStatusLine(line string) string {
185184
text := strings.TrimLeft(plain, " \t")
186185
switch status {
187186
case "pass":
188-
return formatTerraformTestToast(theme.IconCheckmark, text, ending, line)
187+
return formatTerraformTestSuccess(text, ending, line)
189188
case "fail", "error":
190-
return formatTerraformTestToast(theme.IconXMark, text, ending, line)
189+
return formatTerraformTestError(text, ending, line)
191190
default:
192191
return line
193192
}
194193
}
195194

196-
func formatTerraformTestToast(icon, text, ending, fallback string) string {
195+
func formatTerraformTestSuccess(text, ending, fallback string) string {
197196
if ui.Format == nil {
198197
return fallback
199198
}
200-
return strings.TrimSuffix(ui.Format.Toast(icon, text), terraformTestOutputNewline) + ending
199+
return strings.TrimSuffix(ui.Format.Success(text), terraformTestOutputNewline) + ending
200+
}
201+
202+
func formatTerraformTestError(text, ending, fallback string) string {
203+
if ui.Format == nil {
204+
return fallback
205+
}
206+
return strings.TrimSuffix(ui.Format.Error(text), terraformTestOutputNewline) + ending
201207
}
202208

203209
// appendJSONFlag adds `-json` to the terraform test pass-through flags unless it

0 commit comments

Comments
 (0)