add exec shortcut key to container menu

This commit is contained in:
Bradley Cicenas 2019-05-12 20:23:29 +00:00
parent d7384db373
commit b8c38d09ef

View File

@ -135,7 +135,7 @@ func ContainerMenu() MenuFn {
items = append(items, menu.Item{Val: "stop", Label: "[s] stop"}) items = append(items, menu.Item{Val: "stop", Label: "[s] stop"})
items = append(items, menu.Item{Val: "pause", Label: "[p] pause"}) items = append(items, menu.Item{Val: "pause", Label: "[p] pause"})
items = append(items, menu.Item{Val: "restart", Label: "[r] restart"}) items = append(items, menu.Item{Val: "restart", Label: "[r] restart"})
items = append(items, menu.Item{Val: "exec shell", Label: "[e]xec shell"}) items = append(items, menu.Item{Val: "exec", Label: "[e] exec shell"})
} }
if c.Meta["state"] == "exited" || c.Meta["state"] == "created" { if c.Meta["state"] == "exited" || c.Meta["state"] == "created" {
items = append(items, menu.Item{Val: "start", Label: "[s] start"}) items = append(items, menu.Item{Val: "start", Label: "[s] start"})
@ -184,6 +184,10 @@ func ContainerMenu() MenuFn {
}) })
} }
if c.Meta["state"] == "running" { if c.Meta["state"] == "running" {
ui.Handle("/sys/kbd/e", func(ui.Event) {
selected = "exec"
ui.StopLoop()
})
ui.Handle("/sys/kbd/r", func(ui.Event) { ui.Handle("/sys/kbd/r", func(ui.Event) {
selected = "restart" selected = "restart"
ui.StopLoop() ui.StopLoop()
@ -212,7 +216,7 @@ func ContainerMenu() MenuFn {
nextMenu = SingleView nextMenu = SingleView
case "logs": case "logs":
nextMenu = LogMenu nextMenu = LogMenu
case "exec shell": case "exec":
nextMenu = ExecShell nextMenu = ExecShell
case "start": case "start":
nextMenu = Confirm(confirmTxt("start", c.GetMeta("name")), c.Start) nextMenu = Confirm(confirmTxt("start", c.GetMeta("name")), c.Start)