summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean E. Russell <ser@ser1.net>2020-03-07 12:14:19 -0600
committerSean E. Russell <ser@ser1.net>2020-03-07 12:14:19 -0600
commit0eea3106e0c6a5783bc8fcd17bcab3c68b9ddae8 (patch)
tree6dc5e33f7b6928c1ecdffc23e916190ee77262c8
parent9ebcff9b78ef6c529969d34ebac757af9a28ebb2 (diff)
Print key bindings function
-rw-r--r--CHANGELOG.md1
-rw-r--r--cmd/gotop/main.go35
2 files changed, 35 insertions, 1 deletions
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 <C-c>
+Process navigation:
+ k and <Up>: up
+ j and <Down>: down
+ <C-u>: half page up
+ <C-d>: half page down
+ <C-b>: full page up
+ <C-f>: full page down
+ gg and <Home>: jump to top
+ G and <End>: jump to bottom
+Process actions:
+ <Tab>: 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):
+ <Enter> accept filter
+ <C-c> and <Escape>: clear filter
+CPU and Mem graph scaling:
+ h: scale in
+ l: scale out
+?: toggles keybind help menu`)
+ os.Exit(0)
+ }
return nil
}