(opts *CommentOptions, c client.DiscussionClient, baseRepo ghrepo.Interface)
| 242 | } |
| 243 | |
| 244 | func 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. |
no test coverage detected