Skip to content

Commit

Permalink
remove empty string from target parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanBlackburn committed Apr 19, 2024
1 parent 1054947 commit 6ac9fd8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
5 changes: 3 additions & 2 deletions cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ var deployCmd = &cobra.Command{
return
}
var consoleUI runner.ConsoleUI
parsedTargets := filterEmptyStrings(strings.Split(targets, ","))
if useTUI {
consoleUI = runner.NewTUI()
go ProcessOrgEndToEnd(consoleUI, resourceoperation.Deploy, strings.Split(targets, ","))
go ProcessOrgEndToEnd(consoleUI, resourceoperation.Deploy, parsedTargets)
} else {
consoleUI = runner.NewSTDOut()
ProcessOrgEndToEnd(consoleUI, resourceoperation.Deploy, strings.Split(targets, ","))
ProcessOrgEndToEnd(consoleUI, resourceoperation.Deploy, parsedTargets)
}

consoleUI.Start()
Expand Down
6 changes: 4 additions & 2 deletions cmd/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ var diffCmd = &cobra.Command{
return
}
var consoleUI runner.ConsoleUI
parsedTargets := filterEmptyStrings(strings.Split(targets, ","))

if useTUI {
consoleUI = runner.NewTUI()
go ProcessOrgEndToEnd(consoleUI, resourceoperation.Diff, strings.Split(targets, ","))
go ProcessOrgEndToEnd(consoleUI, resourceoperation.Diff, parsedTargets)
} else {
consoleUI = runner.NewSTDOut()
ProcessOrgEndToEnd(consoleUI, resourceoperation.Diff, strings.Split(targets, ","))
ProcessOrgEndToEnd(consoleUI, resourceoperation.Diff, parsedTargets)
}

consoleUI.Start()
Expand Down
10 changes: 10 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,13 @@ func resolveMgmtAcct(
}
return fetchedMgmtAcct, nil
}

func filterEmptyStrings(slice []string) []string {
var result []string
for _, str := range slice {
if str != "" {
result = append(result, str)
}
}
return result
}

0 comments on commit 6ac9fd8

Please sign in to comment.