summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorIbrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>2019-01-04 18:22:50 +0300
committerGitHub <noreply@github.com>2019-01-04 18:22:50 +0300
commit8a7a258de22432c5927ccfd2c9d5c41fea275b19 (patch)
tree1bd6738d5016aecbc944f04f0391197541cbd7c3 /main.go
parentMinor checks and changes throughout files (#53) (diff)
parentcleanup before version increase (diff)
downloadgitbatch-8a7a258de22432c5927ccfd2c9d5c41fea275b19.tar.gz
Merge pull request #54 from isacikgoz/develop
Develop (0.3.0)
Diffstat (limited to 'main.go')
-rw-r--r--main.go28
1 files changed, 18 insertions, 10 deletions
diff --git a/main.go b/main.go
index 7ef48b8..ebe6583 100644
--- a/main.go
+++ b/main.go
@@ -1,9 +1,11 @@
package main
import (
- "github.com/isacikgoz/gitbatch/pkg/app"
+ "os"
+
+ "github.com/isacikgoz/gitbatch/app"
log "github.com/sirupsen/logrus"
- "gopkg.in/alecthomas/kingpin.v2"
+ kingpin "gopkg.in/alecthomas/kingpin.v2"
)
var (
@@ -15,10 +17,19 @@ var (
)
func main() {
- kingpin.Version("gitbatch version 0.2.1")
+ kingpin.Version("gitbatch version 0.3.0")
// parse the command line flag and options
kingpin.Parse()
+ if err := run(); err != nil {
+ log.WithFields(log.Fields{
+ "error": err.Error(),
+ }).Error("Application quitted with an unhandled error.")
+ os.Exit(1)
+ }
+}
+
+func run() error {
// set the app
app, err := app.Setup(&app.SetupConfig{
Directories: *dirs,
@@ -28,15 +39,12 @@ func main() {
Mode: *mode,
})
if err != nil {
- log.Fatal(err)
- }
-
- // execute the app and wait its routine
- err = app.Gui.Run()
- if err != nil {
- log.Fatal(err)
+ return err
}
// good citizens always clean up their mess
defer app.Close()
+
+ // execute the app and wait its routine
+ return app.Gui.Run()
}