aboutsummaryrefslogtreecommitdiffstats
path: root/commands/new.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-25 18:01:32 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-25 18:01:32 +0200
commit6a12373965aff9f80147f8b5bff6a5a104927365 (patch)
treeccc1e34fba059512acab39286a86f6b73c5ad318 /commands/new.go
parent49c90eab26875cbf3094d9a546ad29b426e174a1 (diff)
downloadgit-bug-6a12373965aff9f80147f8b5bff6a5a104927365.tar.gz
more refactoring to have reusable bug action across different UI
Diffstat (limited to 'commands/new.go')
-rw-r--r--commands/new.go16
1 files changed, 9 insertions, 7 deletions
diff --git a/commands/new.go b/commands/new.go
index 9844e121..4168453e 100644
--- a/commands/new.go
+++ b/commands/new.go
@@ -44,18 +44,20 @@ func runNewBug(cmd *cobra.Command, args []string) error {
return err
}
- newBug := bug.NewBug()
-
- createOp := operations.NewCreateOp(author, title, newMessage)
-
- newBug.Append(createOp)
+ newBug, err := operations.Create(author, title, newMessage)
+ if err != nil {
+ return err
+ }
err = newBug.Commit(repo)
- fmt.Printf("%s created\n", newBug.HumanId())
+ if err != nil {
+ return err
+ }
- return err
+ fmt.Printf("%s created\n", newBug.HumanId())
+ return nil
}
var newCmd = &cobra.Command{