Skip to content

Commit

Permalink
cmd *: make tag comma separated options allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
dschofie committed Jul 3, 2024
1 parent 904f16c commit 8b9b15d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var (
func init() {
rootCmd.AddCommand(deployCmd)
deployCmd.Flags().StringVar(&stacks, "stacks", "", "Filter stacks to deploy")
deployCmd.Flags().StringVar(&tag, "tag", "", "Filter accounts and organization units to deploy")
deployCmd.Flags().StringVar(&tag, "tag", "", "Filter accounts and organization units to deploy with a comma separated list")
deployCmd.Flags().StringVar(&targets, "targets", "", "Filter resource types to deploy. Options: organization, scp, stacks")
deployCmd.Flags().StringVar(&orgFile, "org", "organization.yml", "Path to the organization.yml file")
deployCmd.Flags().BoolVar(&useTUI, "tui", false, "use the TUI for deploy")
Expand Down
2 changes: 1 addition & 1 deletion cmd/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func init() {
rootCmd.AddCommand(diffCmd)
diffCmd.Flags().StringVar(&stacks, "stacks", "", "Filter stacks to deploy")
diffCmd.Flags().StringVar(&tag, "tag", "", "Filter accounts and organization units to deploy.")
diffCmd.Flags().StringVar(&tag, "tag", "", "Filter accounts and organization units to deploy with a comma separated list")
diffCmd.Flags().StringVar(&targets, "targets", "", "Filter resource types to deploy. Options: organization, scp, stacks")
diffCmd.Flags().StringVar(&orgFile, "org", "organization.yml", "Path to the organization.yml file")
diffCmd.Flags().BoolVar(&useTUI, "tui", false, "use the TUI for diff")
Expand Down
7 changes: 5 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,13 @@ func ProcessOrgEndToEnd(consoleUI runner.ConsoleUI, cmd int, targets []string) e
}

if len(targets) == 0 || deployStacks {
totalTags := strings.Split(tag, ",")
var accountsToApply []resource.Account
for _, acct := range rootAWSOU.AllDescendentAccounts() {
if contains(tag, acct.AllTags()) || tag == "" {
accountsToApply = append(accountsToApply, *acct)
for _, tag := range totalTags {
if contains(tag, acct.AllTags()) || tag == "" {
accountsToApply = append(accountsToApply, *acct)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion mintlifydocs/commands/deploy.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Flags:
-h, --help help for deploy
--org string Path to the organization.yml file (default "organization.yml")
--stacks string Filter stacks to deploy
--tag string Filter accounts and account groups to deploy
--tag string Filter accounts and account groups to deploy via a comma separated list
--tui use the TUI for deploy
```

Expand Down
2 changes: 1 addition & 1 deletion mintlifydocs/commands/diff.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Flags:
-h, --help help for diff
--org string Path to the organization.yml file (default "organization.yml")
--stacks string Filter stacks to diff
--tag string Filter accounts and account groups to diff.
--tag string Filter accounts and account groups to diff via a comma separated list.
--tui use the TUI for diff
```

Expand Down

0 comments on commit 8b9b15d

Please sign in to comment.