Disable interactivity if any flag is passed

- Error if title is an empty string
This commit is contained in:
rista404 2020-04-25 23:47:07 +02:00
parent 4b32e3f215
commit 76c73db5a0
No known key found for this signature in database
GPG key ID: 74AE4D182C83962A

View file

@ -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 {