Eshel Yaron [Tue, 6 Aug 2024 15:45:40 +0000 (17:45 +0200)]
; New command 'kubed-list-create'
* kubed.el (kubed-list-create): New command.
(kubed-list-mode-map): Bind it.
(kubed-define-resource): Use it to simplify generated
'kubed-create-*' commands.
Eshel Yaron [Tue, 6 Aug 2024 14:59:25 +0000 (16:59 +0200)]
New command 'kubed-list-fit-column-width-to-content'
* kubed.el (kubed-list-column-number-at-point): New function.
(kubed-list-fit-column-width-to-content): New command.
(kubed-list-mode-map): Bind it.
* kubed.texi (Browse Resources): Document it.
Eshel Yaron [Sat, 3 Aug 2024 15:05:27 +0000 (17:05 +0200)]
New transient menu for displaying resources
* kubed-transient.el (kubed-transient-display): New command.
(kubed-transient): Bind it.
* kubed.el (kubed-display-resource-short-description)
(kubed-namespaced-p): New functions.
(kubed-display-resource): New command, use them.
(kubed-display-resource-handle-bookmark)
(kubed-display-resource-make-bookmark): Simplify.
(kubed-define-resource): Adjust generated
'kubed-display-RESOURCE' commands to honor namespace set in
'kubed-transient-display'. Change binding of these commands
from suffix "g" to suffix "RET".
(kubed-api-resources): Add optional arg ONLY-NAMESPACED.
(kubed-prefix-map, kubed-menu-map): Bind 'kubed-define-resource'.
Eshel Yaron [Fri, 2 Aug 2024 20:55:27 +0000 (22:55 +0200)]
New command 'kubed-display-resource-jump-to-list'
* kubed.el (kubed-display-resource-jump-to-list): New command.
(kubed-display-resource-p): New function, use it as
'completion-predicate' property of new command.
(kubed-display-resource-mode-map): Bind new command.
Eshel Yaron [Fri, 2 Aug 2024 20:00:28 +0000 (22:00 +0200)]
Support bookmarking Kubernetes resource buffers
* kubed.el (kubed-display-resource-info): New variable.
(kubed-display-resource-revert)
(kubed-display-resource-in-buffer)
(kubed-display-resource-handle-bookmark)
(kubed-display-resource-make-bookmark): New functions.
(kubed-display-resource-mode): New minor mode, enabled in
buffers that display resources in YAML format.
(kubed-define-resource): Use 'kubed-display-resource-in-buffer'
in definition of generated 'kubed-RESOURCE-description-buffer'.
Eshel Yaron [Fri, 2 Aug 2024 17:21:56 +0000 (19:21 +0200)]
New commands that run kubectl with resource at point as arg
* kubed.el (kubed-define-resource): Also generate
'kubed-RESOURCEs-kubectl-command' command and bind it to "!"
in resource list buffers.
(kubed-read-kubectl-command): New function, extracted from..
(kubed-kubectl-command): ...here.
Eshel Yaron [Fri, 2 Aug 2024 14:33:45 +0000 (16:33 +0200)]
New user option 'kubed-list-filter-operator-alist'
* kubed.el (kubed-list-filter-operator-alist): New option.
(kubed-list-interpret-atomic-filter)
(kubed-list-validate-atomic-filter): Use it instead of hardcoding
operators "=" and "~".
(kubed-list-set-filter): Adjust docstring.
Eshel Yaron [Thu, 1 Aug 2024 19:03:07 +0000 (21:03 +0200)]
Enhance 'kubed-list-read-filter'
Add in-minibuffer feedback for invalid filters and completion for
column names and column values.
* kubed.el (kubed-list-validate-atomic-filter)
(kubed-list-validate-filter): Refine validation.
(kubed--list-read-filter-target-buffer): New local var.
(kubed-list-try-read-filter): New command.
(kubed-list-read-filter-map): New keymap.
(kubed-list-read-filter): Use it, add completion support.
Eshel Yaron [Thu, 1 Aug 2024 15:45:06 +0000 (17:45 +0200)]
New command 'kubed-list-set-filter' in list buffers
* kubed.el: (kubed-list-filter-history-variable)
(kubed-list-filter): New buffer-local variables.
(kubed-list-interpret-atomic-filter)
(kubed-list-interpret-filter)
(kubed-list-validate-atomic-filter)
(kubed-list-validate-filter)
(kubed-list-read-filter): New functions.
(kubed-list-set-filter): New command.
(kubed-list-mode-map): Bind it.
(kubed-define-resource): Use it.
* kubed-transient.el (kubed-transient-rollout): New command.
(kubed-transient): Bind it.
* kubed.el (kubed-watch-deployment-status)
(kubed-restart-deployment): Use namespace argument from
transient when specified.
* kubed.el (kubed-watch-deployment-status): New command.
(kubed-restart-deployment-watch-status): New use option.
(kubed-restart-deployment): Use them.
(deployment): Bind it in prefix map and in list buffer.
* kubed.el (kubed-menu-map): New map with global Kubed menu.
(kubed-menu-bar-mode): New minor mode, adds 'kubed-menu-bar'
to global menu bar.
(kubed-define-resource): Also generate a sub-menu for each
resource type.
(pod, namespace): Adjust.
* kubed-transient.el (kubed-transient-patch): New command.
(kubed-transient): Bind it.
(kubed-transient-apply): Fix capitalization.
* kubed.el (kubed-patch-history): New variable.
(kubed-read-patch): New function.
(kubed-patch): New command.
(kubed-prefix-map): Bind it.
(kubed-define-resource): Add 'kubed-RESOURCEs-patch'
commands that patch the resource at point/mouse in resource
list buffers.
Add argument SILENT to 'kubed-update-RESOURCEs' commands
* kubed.el (kubed-define-resource): Add optional argument
SILENT to generated 'kubed-update-RESOURCEs' commands. Use
it when update is triggered by user initiated operation.
* kubed.el (kubed-api-resources, kubed-resource-names)
(kubed-read-resource-name, kubed-read-resource-type):
New functions.
(kubed-define-resource): Use new 'kubed-resource-names' to
read resource name in different namespace.
(kubed-read-resource-field): Use new 'kubed-api-resources'.
Extend resource name reading functions with namespace arg
* kubed.el (kubed-define-resource): Add optional namespace
argument to 'kubed-read-RESOURCE' functions.
(kubed-attach, kubed-exec): Use it when reading name of pod
in another namespace.
* kubed.el (kubed-define-resource): Also generate
'kubed-RESOURCE-context-menu' function for each RESOURCE,
and add it to 'context-menu-functions' in list buffers.
* kubed.el (tramp-kubernetes-namespace): Remove declaration.
(kubed--static-if): New macro. Compatibility definition of
'static-if' from Emacs 30.
(kubed-pods-dired, kubed-pods-shell): Do not rely on
explicit Kubernetes namespace in remote file name syntax in
Emacs versions earlier than 31.
(kubed-define-resource): Use 'emacsclient-program-name' only
in Emacs 30 or later.