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

Function processCreate

commands/bug/input/input.go:58–87  ·  view source on GitHub ↗
(raw string)

Source from the content-addressed store, hash-verified

56}
57
58func processCreate(raw string) (string, string, error) {
59 lines := strings.Split(raw, "\n")
60
61 var title string
62 var buffer bytes.Buffer
63 for _, line := range lines {
64 if strings.HasPrefix(line, "#") {
65 continue
66 }
67
68 if title == "" {
69 trimmed := strings.TrimSpace(line)
70 if trimmed != "" {
71 title = trimmed
72 }
73 continue
74 }
75
76 buffer.WriteString(line)
77 buffer.WriteString("\n")
78 }
79
80 if title == "" {
81 return "", "", ErrEmptyTitle
82 }
83
84 message := strings.TrimSpace(buffer.String())
85
86 return title, message, nil
87}
88
89const bugCommentTemplate = `%s
90

Callers 2

BugCreateEditorInputFunction · 0.85
BugCreateFileInputFunction · 0.85

Calls 2

StringMethod · 0.65
HasPrefixMethod · 0.45

Tested by

no test coverage detected