Skip to content

Commit

Permalink
fixed exitting on q press
Browse files Browse the repository at this point in the history
  • Loading branch information
nexusriot committed Dec 12, 2022
1 parent 0c19211 commit afcfd8f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
etcd-walker.log
build/
build/


.idea/
12 changes: 4 additions & 8 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewController(
) *Controller {
m := model.NewModel(host, port)
v := view.NewView()
v.Frame.AddText(fmt.Sprintf("Etcd-walker v.0.0.7 (on %s:%s)", host, port), true, tview.AlignCenter, tcell.ColorGreen)
v.Frame.AddText(fmt.Sprintf("Etcd-walker v.0.0.8 (on %s:%s)", host, port), true, tview.AlignCenter, tcell.ColorGreen)

controller := Controller{
debug: debug,
Expand Down Expand Up @@ -128,13 +128,9 @@ func (c *Controller) getPosition(element string, slice []string) int {
func (c *Controller) setInput() {
c.view.App.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
switch event.Key() {
case tcell.KeyRune:
switch event.Rune() {
case 'q':
c.Stop()
return nil
}

case tcell.KeyCtrlQ:
c.Stop()
return nil
}
return event
})
Expand Down
2 changes: 1 addition & 1 deletion pkg/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func NewView() *View {
}

frame := tview.NewFrame(pages)
frame.AddText("[::b][↓,↑][::-] Down/Up [::b][Enter,l/u][::-] Lower/Upper [::b][c[][::-] Create [::b][d[][::-] Delete [::b][e[][::-] Edit value [::b][/][::-] Search [::b][q[][::-] Quit", false, tview.AlignCenter, tcell.ColorWhite)
frame.AddText("[::b][↓,↑][::-] Down/Up [::b][Enter,l/u][::-] Lower/Upper [::b][c[][::-] Create [::b][d[][::-] Delete [::b][e[][::-] Edit value [::b][/][::-] Search [::b][Ctrl+q][::-] Quit", false, tview.AlignCenter, tcell.ColorWhite)

app.SetRoot(frame, true)

Expand Down

0 comments on commit afcfd8f

Please sign in to comment.