From 76c73db5a032215b0ea5f5cb7743064e7664a3a6 Mon Sep 17 00:00:00 2001 From: rista404 Date: Sat, 25 Apr 2020 23:47:07 +0200 Subject: [PATCH] Disable interactivity if any flag is passed - Error if title is an empty string --- command/issue.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/command/issue.go b/command/issue.go index 4bc57e926..67fc592b9 100644 --- a/command/issue.go +++ b/command/issue.go @@ -383,7 +383,7 @@ func issueCreate(cmd *cobra.Command, args []string) error { action := SubmitAction - interactive := !cmd.Flags().Changed("title") || !cmd.Flags().Changed("body") + interactive := !cmd.Flags().Changed("title") && !cmd.Flags().Changed("body") if interactive { tb, err := titleBodySurvey(cmd, title, body, defaults{}, templateFiles) @@ -405,6 +405,10 @@ func issueCreate(cmd *cobra.Command, args []string) error { if body == "" { body = tb.Body } + } else { + if title == "" { + return fmt.Errorf("title can't be blank") + } } if action == PreviewAction {