k9s/internal/view/cmd
tyzbit 548536e40d
fix(history): handle cases where special commands add their command to the stack (#3168)
Fixes #3166

Throughout the code, pushCmd is used for when a command is being executed (switched to) to conditionally add the new command onto the history. The history commands (keybinds `[`, `]`, `-`) only navigate through the stack with indices and therefore should never manipulate the stack -- however with some special commands (specialCmd), navigating to those commands previously unconditionally added the command to the stack unlike "typical" commands like `pods`, `svc`.

Here we pass in the pushCmd boolean to all appropriate special commands so that if the stack should not be manipulated, they do not push their command onto the stack.

The original issue reported issues with Aliases, but there were unreported bugs with Namespaces and Contexts as well. Notably, RBAC commands and Dir commands were not modified as they do not push their command onto the history stack, functioning more as "virtual" commands that will not appear in the history.
2025-03-07 07:32:34 -07:00
..
args.go K9s/release v0.30.7 (#2416) 2024-01-02 23:57:07 -07:00
args_test.go K9s/release v0.30.7 (#2416) 2024-01-02 23:57:07 -07:00
helpers.go Add leading space to Kubernetes context suggestions (#2791) 2024-08-18 09:23:56 -06:00
helpers_test.go K9s/release v0.30.1 (#2369) 2023-12-24 11:29:22 -07:00
interpreter.go Fix typos (#3026) 2024-12-16 09:09:22 -07:00
interpreter_test.go K9s/release v0.30.7 (#2416) 2024-01-02 23:57:07 -07:00
types.go fix(history): handle cases where special commands add their command to the stack (#3168) 2025-03-07 07:32:34 -07:00