MCPcopy Index your code
hub / github.com/git-bug/git-bug / QueryEditorInput

Function QueryEditorInput

commands/bug/input/input.go:208–230  ·  view source on GitHub ↗

QueryEditorInput will open the default editor in the terminal with a template for the user to fill. The file is then processed to extract a query.

(repo repository.RepoCommonStorage, preQuery string)

Source from the content-addressed store, hash-verified

206// QueryEditorInput will open the default editor in the terminal with a
207// template for the user to fill. The file is then processed to extract a query.
208func QueryEditorInput(repo repository.RepoCommonStorage, preQuery string) (string, error) {
209 template := fmt.Sprintf(queryTemplate, preQuery)
210
211 raw, err := input.LaunchEditorWithTemplate(repo, messageFilename, template)
212 if err != nil {
213 return "", err
214 }
215
216 lines := strings.Split(raw, "\n")
217
218 for _, line := range lines {
219 if strings.HasPrefix(line, "#") {
220 continue
221 }
222 trimmed := strings.TrimSpace(line)
223 if trimmed == "" {
224 continue
225 }
226 return trimmed, nil
227 }
228
229 return "", nil
230}

Callers

nothing calls this directly

Calls 2

LaunchEditorWithTemplateFunction · 0.92
HasPrefixMethod · 0.45

Tested by

no test coverage detected