diff --git a/README.md b/README.md index 0511de8..cf83f97 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,12 @@ `kls` is a cli tool based on `kubectl` for managing kubernetes cluster resources. Inspired by `lf` and `ranger` file managers, written in python. -It is lightweight (~250 lines of code) and easy to customize. -Supports mouse navigation as well as keyboard navigation. +It is lightweight (~300 lines of code) and easy to customize. +Supports keyboard navigation and mouse navigation could be enabled (set MOUSE_ENABLED=True in a line #44). ## Key bindings ### For kubectl -You can customize these bindings or add extra bindings in `KEY_BINDINGS` variable of `kls` in a row #5: +You can customize these bindings or add extra bindings in `KEY_BINDINGS` variable of `kls` in a line #5: - `Ctrl+y` - get yaml of resource - `Ctrl+d` - describe resource - `Ctrl+e` - edit resource diff --git a/kls b/kls index fda5a7a..78db4c3 100755 --- a/kls +++ b/kls @@ -1,9 +1,7 @@ #!/usr/bin/env python3 import subprocess, curses, time import curses.ascii -import sys -# constants KEY_BINDINGS = { # can be extended "^Y": { "description": "View resource in YAML format", @@ -235,6 +233,8 @@ def catch_input(menu: Menu): handle_vertical_navigation(key, menu) elif key == "KEY_MOUSE": handle_mouse(menu) + elif key in KEY_BINDINGS.keys(): + handle_key_bindings(key, namespace(), api_resource(), resource()) elif curses.ascii.unctrl(key) in KEY_BINDINGS.keys(): handle_key_bindings(curses.ascii.unctrl(key), namespace(), api_resource(), resource()) elif key in ["/", "\x1b", "KEY_BACKSPACE",