(env *execenv.Env)
| 200 | } |
| 201 | |
| 202 | func 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 | |
| 224 | func UserForQuery(env *execenv.Env) ValidArgsFunction { |
| 225 | return func(cmd *cobra.Command, args []string, toComplete string) (completions []string, directives cobra.ShellCompDirective) { |
no test coverage detected