diff options
Diffstat (limited to 'commands/comment_edit.go')
-rw-r--r-- | commands/comment_edit.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/commands/comment_edit.go b/commands/comment_edit.go index 6a86f37e..6c93ed8b 100644 --- a/commands/comment_edit.go +++ b/commands/comment_edit.go @@ -7,8 +7,9 @@ import ( ) type commentEditOptions struct { - messageFile string - message string + messageFile string + message string + nonInteractive bool } func newCommentEditCommand() *cobra.Command { @@ -34,6 +35,7 @@ func newCommentEditCommand() *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 } @@ -52,6 +54,10 @@ func runCommentEdit(env *Env, opts commentEditOptions, 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.") |