MCPcopy
hub / github.com/cli/cli / resolveCommentID

Function resolveCommentID

pkg/cmd/discussion/comment/comment.go:270–279  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

268// resolveCommentID returns the comment node ID, resolving it from the database
269// ID via the API if the arg was a comment URL.
270func 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).

Callers 3

runDeleteFunction · 0.85
runEditFunction · 0.85
runReplyFunction · 0.85

Calls 2

ResolveCommentNodeIDMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected