MCPcopy Index your code
hub / github.com/git-bug/git-bug / runBugCommentEdit

Function runBugCommentEdit

commands/bug/bug_comment_edit.go:42–76  ·  view source on GitHub ↗
(env *execenv.Env, opts bugCommentEditOptions, args []string)

Source from the content-addressed store, hash-verified

40}
41
42func runBugCommentEdit(env *execenv.Env, opts bugCommentEditOptions, args []string) error {
43 b, commentId, err := env.Backend.Bugs().ResolveComment(args[0])
44 if err != nil {
45 return err
46 }
47
48 if opts.messageFile != "" && opts.message == "" {
49 opts.message, err = buginput.BugCommentFileInput(opts.messageFile)
50 if err != nil {
51 return err
52 }
53 }
54
55 if opts.messageFile == "" && opts.message == "" {
56 if opts.nonInteractive {
57 env.Err.Println("No message given. Use -m or -F option to specify a message. Aborting.")
58 return nil
59 }
60 opts.message, err = buginput.BugCommentEditorInput(env.Backend, "")
61 if err == buginput.ErrEmptyMessage {
62 env.Err.Println("Empty message, aborting.")
63 return nil
64 }
65 if err != nil {
66 return err
67 }
68 }
69
70 _, err = b.EditComment(commentId, opts.message)
71 if err != nil {
72 return err
73 }
74
75 return b.Commit()
76}

Callers 2

newBugCommentEditCommandFunction · 0.85
TestBugCommentEditFunction · 0.85

Calls 5

ResolveCommentMethod · 0.80
BugsMethod · 0.80
EditCommentMethod · 0.80
PrintlnMethod · 0.65
CommitMethod · 0.65

Tested by 1

TestBugCommentEditFunction · 0.68