MCPcopy
hub / github.com/cli/cli / runDelete

Function runDelete

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

Source from the content-addressed store, hash-verified

163}
164
165func runDelete(opts *CommentOptions, c client.DiscussionClient, baseRepo ghrepo.Interface) error {
166 commentID, err := resolveCommentID(opts, c, baseRepo)
167 if err != nil {
168 return err
169 }
170
171 if _, err := c.GetComment(baseRepo.RepoHost(), commentID); err != nil {
172 return err
173 }
174
175 if !opts.Yes {
176 confirmed, err := opts.Prompter.Confirm("Are you sure you want to delete this comment?", false)
177 if err != nil {
178 return err
179 }
180 if !confirmed {
181 return cmdutil.CancelError
182 }
183 }
184
185 return c.DeleteComment(baseRepo, commentID)
186}
187
188func runEdit(opts *CommentOptions, c client.DiscussionClient, baseRepo ghrepo.Interface) error {
189 commentID, err := resolveCommentID(opts, c, baseRepo)

Callers 1

commentRunFunction · 0.70

Calls 5

resolveCommentIDFunction · 0.85
GetCommentMethod · 0.65
RepoHostMethod · 0.65
ConfirmMethod · 0.65
DeleteCommentMethod · 0.65

Tested by

no test coverage detected