(env *execenv.Env)
| 14 | } |
| 15 | |
| 16 | func newBugCommentEditCommand(env *execenv.Env) *cobra.Command { |
| 17 | options := bugCommentEditOptions{} |
| 18 | |
| 19 | cmd := &cobra.Command{ |
| 20 | Use: "edit [COMMENT_ID]", |
| 21 | Short: "Edit an existing comment on a bug", |
| 22 | Args: cobra.ExactArgs(1), |
| 23 | PreRunE: execenv.LoadBackendEnsureUser(env), |
| 24 | RunE: execenv.CloseBackend(env, func(cmd *cobra.Command, args []string) error { |
| 25 | return runBugCommentEdit(env, options, args) |
| 26 | }), |
| 27 | } |
| 28 | |
| 29 | flags := cmd.Flags() |
| 30 | flags.SortFlags = false |
| 31 | |
| 32 | flags.StringVarP(&options.messageFile, "file", "F", "", |
| 33 | "Take the message from the given file. Use - to read the message from the standard input") |
| 34 | |
| 35 | flags.StringVarP(&options.message, "message", "m", "", |
| 36 | "Provide the new message from the command line") |
| 37 | flags.BoolVar(&options.nonInteractive, "non-interactive", false, "Do not ask for user input") |
| 38 | |
| 39 | return cmd |
| 40 | } |
| 41 | |
| 42 | func runBugCommentEdit(env *execenv.Env, opts bugCommentEditOptions, args []string) error { |
| 43 | b, commentId, err := env.Backend.Bugs().ResolveComment(args[0]) |
no test coverage detected