Skip to content

Commit

Permalink
chore: add function to group entries by action in changeset output
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Brown <[email protected]>
  • Loading branch information
94DanielBrown committed Dec 12, 2024
1 parent 42918b3 commit 91d5830
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ssa/changeset.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ func (c *ChangeSet) String() string {
return strings.TrimSuffix(b.String(), "\n")
}

func (c *ChangeSet) ToGroupedMap() map[Action][]string {
res := make(map[Action][]string)
for _, entry := range c.Entries {
res[entry.Action] = append(res[entry.Action], entry.Subject)
}
return res
}

func (c *ChangeSet) ToMap() map[string]Action {
res := make(map[string]Action, len(c.Entries))
for _, entry := range c.Entries {
Expand Down

0 comments on commit 91d5830

Please sign in to comment.