From 4b32e3f2159bec8e7e1d1e9c514062d8fd3f5c64 Mon Sep 17 00:00:00 2001 From: rista404 Date: Thu, 23 Apr 2020 12:20:54 +0200 Subject: [PATCH 1/3] Enable interactive mode only if flags aren't passed --- command/issue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command/issue.go b/command/issue.go index 2f4e145af..4bc57e926 100644 --- a/command/issue.go +++ b/command/issue.go @@ -383,7 +383,7 @@ func issueCreate(cmd *cobra.Command, args []string) error { action := SubmitAction - interactive := title == "" || body == "" + interactive := !cmd.Flags().Changed("title") || !cmd.Flags().Changed("body") if interactive { tb, err := titleBodySurvey(cmd, title, body, defaults{}, templateFiles) From 76c73db5a032215b0ea5f5cb7743064e7664a3a6 Mon Sep 17 00:00:00 2001 From: rista404 Date: Sat, 25 Apr 2020 23:47:07 +0200 Subject: [PATCH 2/3] 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 { From 1f9b7c0fe09f3c8c6cc7715f462fd39f779d5c3f Mon Sep 17 00:00:00 2001 From: Nikola Ristic Date: Tue, 5 May 2020 16:34:31 +0200 Subject: [PATCH 3/3] Disable interactive only if both flags are passed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mislav Marohnić --- command/issue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/command/issue.go b/command/issue.go index 67fc592b9..001785ddc 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)