MCPcopy Create free account
hub / github.com/git-bug/git-bug / User

Function User

commands/completion/helper_completion.go:202–222  ·  view source on GitHub ↗
(env *execenv.Env)

Source from the content-addressed store, hash-verified

200}
201
202func User(env *execenv.Env) ValidArgsFunction {
203 return func(cmd *cobra.Command, args []string, toComplete string) (completions []string, directives cobra.ShellCompDirective) {
204 if err := execenv.LoadBackend(env)(cmd, args); err != nil {
205 return HandleError(err)
206 }
207 defer func() {
208 _ = env.Backend.Close()
209 }()
210
211 ids := env.Backend.Identities().AllIds()
212 completions = make([]string, len(ids))
213 for i, id := range ids {
214 user, err := env.Backend.Identities().ResolveExcerpt(id)
215 if err != nil {
216 return HandleError(err)
217 }
218 completions[i] = user.Id().Human() + "\t" + user.DisplayName()
219 }
220 return completions, cobra.ShellCompDirectiveNoFileComp
221 }
222}
223
224func UserForQuery(env *execenv.Env) ValidArgsFunction {
225 return func(cmd *cobra.Command, args []string, toComplete string) (completions []string, directives cobra.ShellCompDirective) {

Callers 3

newUserShowCommandFunction · 0.92
newUserAdoptCommandFunction · 0.92

Calls 9

LoadBackendFunction · 0.92
HandleErrorFunction · 0.85
AllIdsMethod · 0.80
IdentitiesMethod · 0.80
ResolveExcerptMethod · 0.80
CloseMethod · 0.65
IdMethod · 0.65
DisplayNameMethod · 0.65
HumanMethod · 0.45

Tested by

no test coverage detected