Skip to content

Commit

Permalink
convert to suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
jinnovation committed Sep 22, 2024
1 parent f8e8798 commit 7f62bed
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions kele.el
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ This is idempotent."
(let ((map (make-sparse-keymap)))
(define-key map (kbd "c") #'kele-config)
(define-key map (kbd "r") #'kele-resource)
(define-key map (kbd "p") #'kele-proxy)
(define-key map (kbd "p") #'kele-ports)
(define-key map (kbd "?") #'kele-dispatch)
map)
"Keymap for Kele commands.")
Expand Down Expand Up @@ -2063,11 +2063,17 @@ NAMESPACE and CONTEXT are used to identify the resource type to query for."
proc)
(message "[kele] Started port-forward for %s/%s (port %s)" (oref gvk kind) name port))

(cl-defun kele-kill-port-forward ()
(transient-define-suffix kele-kill-port-forward ()
"Kill a port-forward process.
The port-forward must have been initiated with
`kele-port-forward'."
:inapt-if
(lambda () (= 0 (length (mapcar 'car kele--active-port-forwards))))

:description
"Kill a port-forward"

(interactive)
(if (= 0 (length (mapcar 'car kele--active-port-forwards)))
(message "[kele] No port-forwards active!")
Expand Down Expand Up @@ -2239,13 +2245,15 @@ The `scope' is the current context name."
(interactive)
(transient-setup 'kele-config nil nil :scope (kele-current-context-name)))

(transient-define-prefix kele-proxy ()
"Work with kubectl proxy servers."
["Proxy servers"
(kele--toggle-proxy-current-context)
("P" kele-proxy-toggle :description "Start/stop proxy server for...")]
(transient-define-prefix kele-ports ()
"Work with ports in Kubernetes."
[["Proxy servers"
(kele--toggle-proxy-current-context)
("P" kele-proxy-toggle :description "Start/stop proxy server for...")]
["Ports"
("k" kele-kill-port-forward)]]
(interactive)
(transient-setup 'kele-proxy nil nil :scope (kele-current-context-name)))
(transient-setup 'kele-ports nil nil :scope (kele-current-context-name)))

(easy-menu-define kele-menu-map kele-mode-map
"Menu for Kubernetes management.
Expand Down

0 comments on commit 7f62bed

Please sign in to comment.