From c958e4c34e727d8d18d2b839ed2768316076946d Mon Sep 17 00:00:00 2001 From: Bradley Cicenas Date: Wed, 10 Jan 2018 18:45:14 +0000 Subject: [PATCH] move keybinding for single view, add single view to container menu --- README.md | 3 ++- grid.go | 4 ++-- menus.go | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9e3af26..2bd922f 100644 --- a/README.md +++ b/README.md @@ -70,13 +70,14 @@ Option | Description Key | Action --- | --- + | Open container menu a | Toggle display of all (running and non-running) containers f | Filter displayed containers (`esc` to clear when open) H | Toggle ctop header h | Open help dialog s | Select container sort field r | Reverse container sort order -m | Manage container (start, stop and/or remove) +o | Open single view l | View container logs (`t` to toggle timestamp when open) q | Quit ctop diff --git a/grid.go b/grid.go index 5b50691..97bf381 100644 --- a/grid.go +++ b/grid.go @@ -93,7 +93,7 @@ func Display() bool { ui.StopLoop() }) - ui.Handle("/sys/kbd/m", func(ui.Event) { + ui.Handle("/sys/kbd/", func(ui.Event) { menu = ContainerMenu ui.StopLoop() }) @@ -101,7 +101,7 @@ func Display() bool { menu = LogMenu ui.StopLoop() }) - ui.Handle("/sys/kbd/", func(ui.Event) { + ui.Handle("/sys/kbd/o", func(ui.Event) { single = true ui.StopLoop() }) diff --git a/menus.go b/menus.go index 91f137a..403428f 100644 --- a/menus.go +++ b/menus.go @@ -114,7 +114,7 @@ func ContainerMenu() { m.Selectable = true m.BorderLabel = "Menu" - var items []menu.Item + items := []menu.Item{menu.Item{Val: "single", Label: "single view"}} if c.Meta["state"] == "running" { items = append(items, menu.Item{Val: "stop", Label: "stop"}) } @@ -131,6 +131,9 @@ func ContainerMenu() { HandleKeys("down", m.Down) ui.Handle("/sys/kbd/", func(ui.Event) { switch m.SelectedItem().Val { + case "single": + SingleView(c) + ui.StopLoop() case "start": c.Start() ui.StopLoop()