diff options
| author | Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com> | 2019-01-01 15:04:04 +0300 |
|---|---|---|
| committer | Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com> | 2019-01-01 15:04:04 +0300 |
| commit | 457d39a46dc891d18b0b199c2295f38e5538ca8a (patch) | |
| tree | ccbcd49fa127bc1ffa4b69b2f353bd4d01bf2631 /main.go | |
| parent | add page up page down controls on the repo view (diff) | |
| download | gitbatch-457d39a46dc891d18b0b199c2295f38e5538ca8a.tar.gz | |
remove utility package
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 22 |
1 files changed, 15 insertions, 7 deletions
@@ -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() } |
