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

Function Label

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

Source from the content-addressed store, hash-verified

100}
101
102func 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
124func Ls(env *execenv.Env) ValidArgsFunction {
125 return func(cmd *cobra.Command, args []string, toComplete string) (completions []string, directives cobra.ShellCompDirective) {

Callers 1

NewBugCommandFunction · 0.92

Calls 6

LoadBackendFunction · 0.92
HandleErrorFunction · 0.85
BugsMethod · 0.80
CloseMethod · 0.65
ValidLabelsMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected