diff options
Diffstat (limited to 'commands')
-rw-r--r-- | commands/add.go | 16 | ||||
-rw-r--r-- | commands/comment_add.go | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/commands/add.go b/commands/add.go index 081c99f1..ecc2381e 100644 --- a/commands/add.go +++ b/commands/add.go @@ -17,20 +17,20 @@ var ( func runAddBug(cmd *cobra.Command, args []string) error { var err error - if addMessageFile != "" && addMessage == "" { - addMessage, err = input.FromFile(addMessageFile) - if err != nil { - return err - } - } - backend, err := cache.NewRepoCache(repo) if err != nil { return err } defer backend.Close() - if addMessage == "" || addTitle == "" { + if addMessageFile != "" && addMessage == "" { + addTitle, addMessage, err = input.BugCreateFileInput(addMessageFile) + if err != nil { + return err + } + } + + if addMessageFile == "" && (addMessage == "" || addTitle == "") { addTitle, addMessage, err = input.BugCreateEditorInput(backend, addTitle, addMessage) if err == input.ErrEmptyTitle { diff --git a/commands/comment_add.go b/commands/comment_add.go index 5a7cd6a8..d0912844 100644 --- a/commands/comment_add.go +++ b/commands/comment_add.go @@ -27,13 +27,13 @@ func runCommentAdd(cmd *cobra.Command, args []string) error { } if commentAddMessageFile != "" && commentAddMessage == "" { - commentAddMessage, err = input.FromFile(commentAddMessageFile) + commentAddMessage, err = input.BugCommentFileInput(commentAddMessageFile) if err != nil { return err } } - if commentAddMessage == "" { + if commentAddMessageFile == "" && commentAddMessage == "" { commentAddMessage, err = input.BugCommentEditorInput(backend, "") if err == input.ErrEmptyMessage { fmt.Println("Empty message, aborting.") |