BugCompletion complete a bug id
(env *execenv.Env)
| 14 | |
| 15 | // BugCompletion complete a bug id |
| 16 | func BugCompletion(env *execenv.Env) completion.ValidArgsFunction { |
| 17 | return func(cmd *cobra.Command, args []string, toComplete string) (completions []string, directives cobra.ShellCompDirective) { |
| 18 | if err := execenv.LoadBackend(env)(cmd, args); err != nil { |
| 19 | return completion.HandleError(err) |
| 20 | } |
| 21 | defer func() { |
| 22 | _ = env.Backend.Close() |
| 23 | }() |
| 24 | |
| 25 | return bugWithBackend(env.Backend, toComplete) |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | func bugWithBackend(backend *cache.RepoCache, toComplete string) (completions []string, directives cobra.ShellCompDirective) { |
| 30 | for _, id := range backend.Bugs().AllIds() { |
no test coverage detected