diff options
| author | Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com> | 2019-01-04 18:22:50 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-04 18:22:50 +0300 |
| commit | 8a7a258de22432c5927ccfd2c9d5c41fea275b19 (patch) | |
| tree | 1bd6738d5016aecbc944f04f0391197541cbd7c3 /main.go | |
| parent | Minor checks and changes throughout files (#53) (diff) | |
| parent | cleanup before version increase (diff) | |
| download | gitbatch-8a7a258de22432c5927ccfd2c9d5c41fea275b19.tar.gz | |
Merge pull request #54 from isacikgoz/develop
Develop (0.3.0)
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 28 |
1 files changed, 18 insertions, 10 deletions
@@ -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() } |
