MCPcopy
hub / github.com/cli/cli / resolveBody

Function resolveBody

pkg/cmd/discussion/comment/comment.go:283–302  ·  view source on GitHub ↗

resolveBody determines the comment body from flags or interactive input. defaultBody is used as the initial content in the editor (e.g., existing comment body for edits).

(opts *CommentOptions, defaultBody string)

Source from the content-addressed store, hash-verified

281// resolveBody determines the comment body from flags or interactive input.
282// defaultBody is used as the initial content in the editor (e.g., existing comment body for edits).
283func resolveBody(opts *CommentOptions, defaultBody string) (string, error) {
284 if opts.BodyFile != "" {
285 b, err := cmdutil.ReadFile(opts.BodyFile, opts.IO.In)
286 if err != nil {
287 return "", err
288 }
289 return string(b), nil
290 }
291
292 if opts.Body != "" {
293 return opts.Body, nil
294 }
295
296 body, err := opts.Prompter.MarkdownEditor("Body", defaultBody, false)
297 if err != nil {
298 return "", err
299 }
300
301 return body, nil
302}

Callers 3

runEditFunction · 0.85
runReplyFunction · 0.85
runAddFunction · 0.85

Calls 2

ReadFileFunction · 0.92
MarkdownEditorMethod · 0.65

Tested by

no test coverage detected