From acd7fa2ddf097263e62d1281657cb5cb41ae7741 Mon Sep 17 00:00:00 2001 From: Zaq? Wiedmann Date: Mon, 23 Apr 2018 09:13:40 -0700 Subject: [PATCH] [#74] support exiting `ci view` with ESC and "q" --- cmd/ciView.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/ciView.go b/cmd/ciView.go index 55976f2f..45b8fc69 100644 --- a/cmd/ciView.go +++ b/cmd/ciView.go @@ -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 {