(env *execenv.Env)
| 15 | } |
| 16 | |
| 17 | func newBugCommentNewCommand(env *execenv.Env) *cobra.Command { |
| 18 | options := bugCommentNewOptions{} |
| 19 | |
| 20 | cmd := &cobra.Command{ |
| 21 | Use: "new [BUG_ID]", |
| 22 | Short: "Add a new comment to a bug", |
| 23 | PreRunE: execenv.LoadBackendEnsureUser(env), |
| 24 | RunE: execenv.CloseBackend(env, func(cmd *cobra.Command, args []string) error { |
| 25 | return runBugCommentNew(env, options, args) |
| 26 | }), |
| 27 | ValidArgsFunction: BugCompletion(env), |
| 28 | } |
| 29 | |
| 30 | flags := cmd.Flags() |
| 31 | flags.SortFlags = false |
| 32 | |
| 33 | flags.StringVarP(&options.messageFile, "file", "F", "", |
| 34 | "Take the message from the given file. Use - to read the message from the standard input") |
| 35 | |
| 36 | flags.StringVarP(&options.message, "message", "m", "", |
| 37 | "Provide the new message from the command line") |
| 38 | flags.BoolVar(&options.nonInteractive, "non-interactive", false, "Do not ask for user input") |
| 39 | |
| 40 | return cmd |
| 41 | } |
| 42 | |
| 43 | func runBugCommentNew(env *execenv.Env, opts bugCommentNewOptions, args []string) error { |
| 44 | b, _, err := ResolveSelected(env.Backend, args) |
no test coverage detected