Fix delete
This commit is contained in:
parent
7a979b62f1
commit
2044c33ee3
|
@ -4,12 +4,12 @@
|
||||||
`kls` is a cli tool based on `kubectl` for managing kubernetes cluster resources.
|
`kls` is a cli tool based on `kubectl` for managing kubernetes cluster resources.
|
||||||
Inspired by `lf` and `ranger` file managers, written in python.
|
Inspired by `lf` and `ranger` file managers, written in python.
|
||||||
|
|
||||||
It is lightweight (~250 lines of code) and easy to customize.
|
It is lightweight (~300 lines of code) and easy to customize.
|
||||||
Supports mouse navigation as well as keyboard navigation.
|
Supports keyboard navigation and mouse navigation could be enabled (set MOUSE_ENABLED=True in a line #44).
|
||||||
|
|
||||||
## Key bindings
|
## Key bindings
|
||||||
### For kubectl
|
### 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+y` - get yaml of resource
|
||||||
- `Ctrl+d` - describe resource
|
- `Ctrl+d` - describe resource
|
||||||
- `Ctrl+e` - edit resource
|
- `Ctrl+e` - edit resource
|
||||||
|
|
4
kls
4
kls
|
@ -1,9 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import subprocess, curses, time
|
import subprocess, curses, time
|
||||||
import curses.ascii
|
import curses.ascii
|
||||||
import sys
|
|
||||||
|
|
||||||
# constants
|
|
||||||
KEY_BINDINGS = { # can be extended
|
KEY_BINDINGS = { # can be extended
|
||||||
"^Y": {
|
"^Y": {
|
||||||
"description": "View resource in YAML format",
|
"description": "View resource in YAML format",
|
||||||
|
@ -235,6 +233,8 @@ def catch_input(menu: Menu):
|
||||||
handle_vertical_navigation(key, menu)
|
handle_vertical_navigation(key, menu)
|
||||||
elif key == "KEY_MOUSE":
|
elif key == "KEY_MOUSE":
|
||||||
handle_mouse(menu)
|
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():
|
elif curses.ascii.unctrl(key) in KEY_BINDINGS.keys():
|
||||||
handle_key_bindings(curses.ascii.unctrl(key), namespace(), api_resource(), resource())
|
handle_key_bindings(curses.ascii.unctrl(key), namespace(), api_resource(), resource())
|
||||||
elif key in ["/", "\x1b", "KEY_BACKSPACE",
|
elif key in ["/", "\x1b", "KEY_BACKSPACE",
|
||||||
|
|
Loading…
Reference in New Issue