resolveCommentID returns the comment node ID, resolving it from the database ID via the API if the arg was a comment URL.
(opts *CommentOptions, c client.DiscussionClient, repo ghrepo.Interface)
| 268 | // resolveCommentID returns the comment node ID, resolving it from the database |
| 269 | // ID via the API if the arg was a comment URL. |
| 270 | func resolveCommentID(opts *CommentOptions, c client.DiscussionClient, repo ghrepo.Interface) (string, error) { |
| 271 | if opts.ParsedArg.CommentNodeID != "" { |
| 272 | return opts.ParsedArg.CommentNodeID, nil |
| 273 | } |
| 274 | if opts.ParsedArg.CommentDatabaseID != 0 { |
| 275 | return c.ResolveCommentNodeID(repo, opts.ParsedArg.CommentDatabaseID) |
| 276 | } |
| 277 | // We should never reach here due to checks at flag parsing. |
| 278 | return "", fmt.Errorf("no comment ID/URL available") |
| 279 | } |
| 280 | |
| 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). |
no test coverage detected