aboutsummaryrefslogtreecommitdiffstats
path: root/commands/comment_add.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/comment_add.go')
-rw-r--r--commands/comment_add.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/commands/comment_add.go b/commands/comment_add.go
index 438e983a..54c75702 100644
--- a/commands/comment_add.go
+++ b/commands/comment_add.go
@@ -9,8 +9,9 @@ import (
)
type commentAddOptions struct {
- messageFile string
- message string
+ messageFile string
+ message string
+ nonInteractive bool
}
func newCommentAddCommand() *cobra.Command {
@@ -35,6 +36,7 @@ func newCommentAddCommand() *cobra.Command {
flags.StringVarP(&options.message, "message", "m", "",
"Provide the new message from the command line")
+ flags.BoolVar(&options.nonInteractive, "non-interactive", false, "Do not ask for user input")
return cmd
}
@@ -53,6 +55,10 @@ func runCommentAdd(env *Env, opts commentAddOptions, args []string) error {
}
if opts.messageFile == "" && opts.message == "" {
+ if opts.nonInteractive {
+ env.err.Println("No message given. Use -m or -F option to specify a message. Aborting.")
+ return nil
+ }
opts.message, err = input.BugCommentEditorInput(env.backend, "")
if err == input.ErrEmptyMessage {
env.err.Println("Empty message, aborting.")