(goto-char next)))
(defun kubed-list-copy-as-kill (click)
- "Copy name of Kubernetes resource at CLICK to into the kill ring."
+ "Copy name of Kubernetes resource at CLICK into the kill ring."
(interactive (list last-nonmenu-event) kubed-list-mode)
(if-let ((ent (tabulated-list-get-entry (mouse-set-point click)))
(new (aref ent 0)))
(message "Copied resource name `%s'" new))
(user-error "No Kubernetes resource at point")))
+(defun kubed-list-context-menu (menu click)
+ "Extend MENU with common actions on Kubernetes resource at CLICK."
+ (when (tabulated-list-get-entry (posn-point (event-start click)))
+ (define-key menu [kubed-list-copy-as-kill]
+ '(menu-item "Copy name" kubed-list-copy-as-kill)))
+ menu)
+
(defvar-keymap kubed-list-mode-map
:doc "Common keymap for Kubernetes resource list buffers."
"/" #'kubed-list-set-filter
(save-excursion
(goto-char (point-min))
(while (not (eobp))
- (when-let ((mark (alist-get (tabulated-list-get-id) marks nil nil #'equal)))
+ (when-let ((mark (alist-get (tabulated-list-get-id)
+ marks nil nil #'equal)))
(tabulated-list-put-tag mark))
(forward-line))))))
nil t)
- (setq-local truncate-string-ellipsis (propertize ">" 'face 'shadow)))
+ (setq-local truncate-string-ellipsis (propertize ">" 'face 'shadow))
+ (add-hook 'context-menu-functions #'kubed-list-context-menu nil t))
;;;###autoload
(defmacro kubed-define-resource (resource &optional properties &rest commands)
Toggle @code{kubed-all-namespaces-mode}. When enabled, resource lists
for namespaced resource types show resources from all namespaces, not
just the current namespace.
+@kindex w
+@findex kubed-list-copy-as-kill
+@item w
+Copy name of resource at point into the kill ring
+(@code{kubed-list-copy-as-kill}).
@kindex n
@findex next-line
@item n