mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
fix: handlers used to work after "exec sh" command
feature: hot key for "exec sh"
This commit is contained in:
parent
f27de1c29e
commit
e68f7ba96a
4
grid.go
4
grid.go
@ -116,6 +116,10 @@ func Display() bool {
|
||||
menu = LogMenu
|
||||
ui.StopLoop()
|
||||
})
|
||||
ui.Handle("/sys/kbd/e", func(ui.Event) {
|
||||
menu = ExecSh
|
||||
ui.StopLoop()
|
||||
})
|
||||
ui.Handle("/sys/kbd/o", func(ui.Event) {
|
||||
menu = SingleView
|
||||
ui.StopLoop()
|
||||
|
6
menus.go
6
menus.go
@ -27,6 +27,7 @@ var helpDialog = []menu.Item{
|
||||
{"[r] - reverse container sort order", ""},
|
||||
{"[o] - open single view", ""},
|
||||
{"[l] - view container logs ([t] to toggle timestamp when open)", ""},
|
||||
{"[e] - exec sh", ""},
|
||||
{"[S] - save current configuration to file", ""},
|
||||
{"[q] - exit ctop", ""},
|
||||
}
|
||||
@ -219,6 +220,11 @@ func ExecSh() MenuFn {
|
||||
return nil
|
||||
}
|
||||
|
||||
ui.DefaultEvtStream.ResetHandlers()
|
||||
defer ui.DefaultEvtStream.ResetHandlers()
|
||||
ui.StopLoop()
|
||||
defer ui.Loop()
|
||||
|
||||
// Reset colors && clear screen && run sh
|
||||
cmdName := fmt.Sprintf("echo '\033[0m' && clear && docker exec -it %s sh", c.GetMeta("name"))
|
||||
cmd := exec.Command("bash", "-c", cmdName)
|
||||
|
Loading…
Reference in New Issue
Block a user