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

Function BugTitleEditorInput

commands/bug/input/input.go:148–176  ·  view source on GitHub ↗

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

(repo repository.RepoCommonStorage, preTitle string)

Source from the content-addressed store, hash-verified

146// BugTitleEditorInput will open the default editor in the terminal with a
147// template for the user to fill. The file is then processed to extract a title.
148func BugTitleEditorInput(repo repository.RepoCommonStorage, preTitle string) (string, error) {
149 template := fmt.Sprintf(bugTitleTemplate, preTitle)
150
151 raw, err := input.LaunchEditorWithTemplate(repo, messageFilename, template)
152 if err != nil {
153 return "", err
154 }
155
156 lines := strings.Split(raw, "\n")
157
158 var title string
159 for _, line := range lines {
160 if strings.HasPrefix(line, "#") {
161 continue
162 }
163 trimmed := strings.TrimSpace(line)
164 if trimmed == "" {
165 continue
166 }
167 title = trimmed
168 break
169 }
170
171 if title == "" {
172 return "", ErrEmptyTitle
173 }
174
175 return title, nil
176}
177
178const queryTemplate = `%s
179

Callers

nothing calls this directly

Calls 2

LaunchEditorWithTemplateFunction · 0.92
HasPrefixMethod · 0.45

Tested by

no test coverage detected