Skip to content

Commit

Permalink
Merge pull request #145 from zaquestion/exit_ci_view
Browse files Browse the repository at this point in the history
[#74] support exiting `ci view` with ESC and "q"
  • Loading branch information
zaquestion authored Apr 23, 2018
2 parents 1ab1d35 + acd7fa2 commit ada6016
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/ciView.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ Feedback Welcome!: https://github.com/zaquestion/lab/issues/74`,
boxes = make(map[string]*tview.TextView)
jobsCh := make(chan []*gitlab.Job)

a.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
if event.Key() == tcell.KeyEscape || event.Rune() == 'q' {
a.Stop()
return nil
}
return event
})
go updateJobs(a, jobsCh, project.ID, branch)
go refreshScreen(a)
if err := a.SetRoot(root, true).SetBeforeDrawFunc(jobsView(a, jobsCh, root)).SetAfterDrawFunc(connectJobsView(a)).Run(); err != nil {
Expand Down

0 comments on commit ada6016

Please sign in to comment.