MCPcopy
hub / github.com/cli/cli / runAdd

Function runAdd

pkg/cmd/discussion/comment/comment.go:244–266  ·  view source on GitHub ↗
(opts *CommentOptions, c client.DiscussionClient, baseRepo ghrepo.Interface)

Source from the content-addressed store, hash-verified

242}
243
244func runAdd(opts *CommentOptions, c client.DiscussionClient, baseRepo ghrepo.Interface) error {
245 body, err := resolveBody(opts, "")
246 if err != nil {
247 return err
248 }
249
250 opts.IO.StartProgressIndicator()
251 discussion, err := c.GetByNumber(baseRepo, opts.ParsedArg.Number)
252 opts.IO.StopProgressIndicator()
253 if err != nil {
254 return err
255 }
256
257 opts.IO.StartProgressIndicator()
258 comment, err := c.AddComment(baseRepo, discussion.ID, body, "")
259 opts.IO.StopProgressIndicator()
260 if err != nil {
261 return err
262 }
263
264 fmt.Fprintln(opts.IO.Out, comment.URL)
265 return nil
266}
267
268// resolveCommentID returns the comment node ID, resolving it from the database
269// ID via the API if the arg was a comment URL.

Callers 1

commentRunFunction · 0.70

Calls 5

resolveBodyFunction · 0.85
GetByNumberMethod · 0.65
StopProgressIndicatorMethod · 0.65
AddCommentMethod · 0.65

Tested by

no test coverage detected