Skip to content

Commit

Permalink
chore: code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
levkohimins committed Sep 12, 2024
1 parent 35344a9 commit a1b3825
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions shell/run_shell_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

"github.com/hashicorp/go-version"

"github.com/gruntwork-io/go-commons/collections"
"github.com/gruntwork-io/go-commons/errors"
"github.com/gruntwork-io/terragrunt/options"
"github.com/gruntwork-io/terragrunt/util"
Expand Down Expand Up @@ -445,10 +446,12 @@ func extractSemVerTags(tags []string) []*version.Version {

// shouldForceForwardTFStdout returns true if at least one of the conditions is met, args contains the `-json` flag or the `output` or `state` command.
func shouldForceForwardTFStdout(args cli.Args) bool {
switch args.CommandName() {
case terraform.CommandNameOutput, terraform.CommandNameState, terraform.CommandNameVersion, terraform.CommandNameConsole:
return true
tfCommands := []string{
terraform.CommandNameOutput,
terraform.CommandNameState,
terraform.CommandNameVersion,
terraform.CommandNameConsole,
}

return args.Tail().Contains(terraform.FlagNameJSON)
return collections.ListContainsElement(tfCommands, args.CommandName()) || args.Tail().Contains(terraform.FlagNameJSON)
}

0 comments on commit a1b3825

Please sign in to comment.