| 26 | ) |
| 27 | |
| 28 | func listGroups(cmd *cobra.Command, args []string) (err error) { |
| 29 | dbx := teamNewFunc(config) |
| 30 | arg := team.NewGroupsListArg() |
| 31 | groups, err := listTeamGroups(dbx, arg) |
| 32 | if err != nil { |
| 33 | return err |
| 34 | } |
| 35 | |
| 36 | commandVerboseStatus(cmd, "Listed %d team groups", len(groups)) |
| 37 | |
| 38 | return commandOutput(cmd).Render(func(w io.Writer) error { |
| 39 | return renderTeamGroups(w, groups) |
| 40 | }, newJSONCommandOperationOutput(cmd, teamInfoInput{}, teamGroupOperationResults(groups), nil)) |
| 41 | } |
| 42 | |
| 43 | func listTeamGroups(dbx teamClient, arg *team.GroupsListArg) ([]*team_common.GroupSummary, error) { |
| 44 | var groups []*team_common.GroupSummary |