Skip to content

Commit

Permalink
actions: tools.gh.ActionUsers macro signature
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed May 6, 2022
1 parent 86282ef commit 60f5609
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion completers/circleci_completer/cmd/context_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func init() {
action.ActionVcsTypes(),
carapace.ActionCallback(func(c carapace.Context) carapace.Action {
if c.Args[0] == "github" {
return gh.ActionUsers(false, true)
return gh.ActionUsers(gh.UserOpts{Organizations: true})
}
return carapace.ActionValues()
}),
Expand Down
10 changes: 8 additions & 2 deletions pkg/actions/tools/gh/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@ func ActionOwnerRepositories() carapace.Action {
})
}

func ActionUsers(users bool, orgs bool) carapace.Action {
type UserOpts action.UserOpts

func ActionUsers(opts UserOpts) carapace.Action {
return carapace.ActionCallback(func(c carapace.Context) carapace.Action {
return action.ActionUsers(&cobra.Command{}, action.UserOpts{Users: users, Organizations: orgs})
if !opts.Users && !opts.Organizations {
opts.Users = true
opts.Organizations = true
}
return action.ActionUsers(&cobra.Command{}, action.UserOpts(opts))
})
}

0 comments on commit 60f5609

Please sign in to comment.