(env *execenv.Env)
| 100 | } |
| 101 | |
| 102 | func Label(env *execenv.Env) ValidArgsFunction { |
| 103 | return func(cmd *cobra.Command, args []string, toComplete string) (completions []string, directives cobra.ShellCompDirective) { |
| 104 | if err := execenv.LoadBackend(env)(cmd, args); err != nil { |
| 105 | return HandleError(err) |
| 106 | } |
| 107 | defer func() { |
| 108 | _ = env.Backend.Close() |
| 109 | }() |
| 110 | |
| 111 | labels := env.Backend.Bugs().ValidLabels() |
| 112 | completions = make([]string, len(labels)) |
| 113 | for i, label := range labels { |
| 114 | if strings.Contains(label.String(), " ") { |
| 115 | completions[i] = fmt.Sprintf("\"%s\"\tLabel", label.String()) |
| 116 | } else { |
| 117 | completions[i] = fmt.Sprintf("%s\tLabel", label.String()) |
| 118 | } |
| 119 | } |
| 120 | return completions, cobra.ShellCompDirectiveNoFileComp |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | func Ls(env *execenv.Env) ValidArgsFunction { |
| 125 | return func(cmd *cobra.Command, args []string, toComplete string) (completions []string, directives cobra.ShellCompDirective) { |
no test coverage detected