summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorIbrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>2019-01-01 15:04:04 +0300
committerIbrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>2019-01-01 15:04:04 +0300
commit457d39a46dc891d18b0b199c2295f38e5538ca8a (patch)
treeccbcd49fa127bc1ffa4b69b2f353bd4d01bf2631 /main.go
parentadd page up page down controls on the repo view (diff)
downloadgitbatch-457d39a46dc891d18b0b199c2295f38e5538ca8a.tar.gz
remove utility package
Diffstat (limited to 'main.go')
-rw-r--r--main.go22
1 files changed, 15 insertions, 7 deletions
diff --git a/main.go b/main.go
index 573f1ae..d904e8d 100644
--- a/main.go
+++ b/main.go
@@ -1,6 +1,8 @@
package main
import (
+ "os"
+
"github.com/isacikgoz/gitbatch/pkg/app"
log "github.com/sirupsen/logrus"
kingpin "gopkg.in/alecthomas/kingpin.v2"
@@ -19,6 +21,15 @@ func main() {
// 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()
}