From 0eea3106e0c6a5783bc8fcd17bcab3c68b9ddae8 Mon Sep 17 00:00:00 2001 From: "Sean E. Russell" Date: Sat, 7 Mar 2020 12:14:19 -0600 Subject: Print key bindings function --- CHANGELOG.md | 1 + cmd/gotop/main.go | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b1d134..853ca62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Adds support for system-wide configurations. This improves support for package maintainers. +- Help function to print key bindings ### Changed diff --git a/cmd/gotop/main.go b/cmd/gotop/main.go index c408f18..4dbd715 100644 --- a/cmd/gotop/main.go +++ b/cmd/gotop/main.go @@ -73,7 +73,8 @@ Options: -x, --export=PORT Enable metrics for export on the specified port. -X, --extensions=NAMES Enables the listed extensions. This is a comma-separated list without the .so suffix. The current and config directories will be searched. --test Runs tests and exits with success/failure code - --print-paths List out the paths that gotop will look for gotop.conf, layouts, color schemes, and extensions + --print-paths List out the paths that gotop will look for gotop.conf, layouts, color schemes, and extensions + --print-keys Show the keyboard bindings Built-in layouts: @@ -167,6 +168,38 @@ Colorschemes: fmt.Println(strings.Join(paths, "\n")) os.Exit(0) } + if args["--print-keys"].(bool) { + fmt.Println(` +Quit: q or +Process navigation: + k and : up + j and : down + : half page up + : half page down + : full page up + : full page down + gg and : jump to top + G and : jump to bottom +Process actions: + : toggle process grouping + dd: kill selected process or group of processes with SIGTERM + d3: kill selected process or group of processes with SIGQUIT + d9: kill selected process or group of processes with SIGKILL +Process sorting + c: CPU + m: Mem + p: PID +Process filtering: + /: start editing filter + (while editing): + accept filter + and : clear filter +CPU and Mem graph scaling: + h: scale in + l: scale out +?: toggles keybind help menu`) + os.Exit(0) + } return nil } -- cgit v1.2.3