Skip to content

Commit

Permalink
Fix printing summary at the end
Browse files Browse the repository at this point in the history
  • Loading branch information
mkchoi212 committed Dec 30, 2017
1 parent 1e38e63 commit 873a977
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ func parseInput(g *gocui.Gui, v *gocui.View) error {
return nil
}

func keyBindings(g *gocui.Gui) error {
err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit)
err = g.SetKeybinding("", gocui.KeyEnter, gocui.ModNone, parseInput)
return err
}

func main() {
var err error
conflicts, err = Find()
Expand All @@ -70,23 +64,26 @@ func main() {
}
conflictCount = len(conflicts)

printSummary()

g, err := gocui.NewGui(gocui.OutputNormal)
if err != nil {
log.Panicln(err)
}
defer g.Close()
g.SetManagerFunc(layout)
g.Cursor = true

if err := keyBindings(g); err != nil {
log.Panicln(err)
if err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil {
log.Panic(err)
}
if err := g.SetKeybinding("", gocui.KeyEnter, gocui.ModNone, parseInput); err != nil {
log.Panic(err)
}

conflicts[0].Select(g, false)

if err := g.MainLoop(); err != nil && err != gocui.ErrQuit {
log.Panicln(err)
}

g.Close()
printSummary()
}

0 comments on commit 873a977

Please sign in to comment.