k9s
k9s copied to clipboard
History forward truncate
This pull request introduces enhancements to the History functionality in the internal/model package, focusing on enforcing a history limit, handling forward history truncation, and updating test cases to reflect these changes.
Updates to History functionality:
internal/model/history.go: Added logic to truncate forward history when a new command is pushed and the active command index is not at the end. Enforced a history limit by removing the oldest entry when the limit is exceeded.
Updates to test cases:
internal/model/history_test.go: UpdatedTestHistoryto reflect the new behavior of enforcing the history limit, ensuring the oldest command is removed when the limit is exceeded.internal/model/history_test.go: UpdatedTestHistoryDupsto verify the updated behavior of thePushmethod, ensuring commands are correctly added while respecting the history limit.
GitHub issue: https://github.com/derailed/k9s/issues/3406