[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/kubed 238f38c847 52/70: New commands that run kubectl w
From: |
ELPA Syncer |
Subject: |
[elpa] externals/kubed 238f38c847 52/70: New commands that run kubectl with resource at point as arg |
Date: |
Tue, 6 Aug 2024 06:58:38 -0400 (EDT) |
branch: externals/kubed
commit 238f38c8472f4c57c5519e363e2a9f4d1330c6b3
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>
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.
---
kubed.el | 41 ++++++++++++++++++++++++++++++-----------
1 file changed, 30 insertions(+), 11 deletions(-)
diff --git a/kubed.el b/kubed.el
index 7919c7b661..c2d4586169 100644
--- a/kubed.el
+++ b/kubed.el
@@ -566,6 +566,17 @@ Other keyword arguments that go between PROPERTIES and
COMMANDS are:
"o" "Pop to buffer showing description of"
(switch-to-buffer-other-window
(,desc-fun ,resource . ,(when namespaced '(k8sns)))))
+ (kubectl-command
+ "!" "Execute kubectl command with"
+ (kubed-kubectl-command
+ (kubed-read-kubectl-command
+ "Execute command: "
+ (cons (concat
+ " "
+ ,@(when namespaced
+ `((when k8sns (concat "-n " k8sns " "))))
+ ,(symbol-name resource) " " ,resource)
+ 0)))) ; Put point after "kubectl ".
(delete "D" "Delete"
,(if namespaced
`(if k8sns
@@ -2478,6 +2489,17 @@ Optional argument DEFAULT is the minibuffer default
argument."
(declare-function cobra-read-command-line "cobra"
(prompt initial &optional hist))
+(defun kubed-read-kubectl-command (prompt &optional initial)
+ "Prompt with PROMPT for a `kubectl' command line.
+
+Optional argument INITIAL added to the initial minibuffer input
+following the value of `kubed-kubectl-program' and a space character."
+ (let ((init (if (consp initial)
+ (cons (concat kubed-kubectl-program " " (car initial))
+ (+ (length kubed-kubectl-program) 1 (cdr initial)))
+ (concat kubed-kubectl-program " " initial))))
+ (cobra-read-command-line prompt init 'kubed-kubectl-command-history)))
+
;;;###autoload
(defun kubed-kubectl-command (command)
"Execute `kubectl' COMMAND.
@@ -2486,18 +2508,15 @@ This function calls `shell-command' (which see) to do
the work.
Interactively, prompt for COMMAND with completion for `kubectl' arguments."
(interactive
- (list (cobra-read-command-line
+ (list (kubed-read-kubectl-command
"Command: "
- (concat
- kubed-kubectl-program " "
- (let* ((args (kubed-transient-args))
- (prefix (and (fboundp 'transient-prefix-object)
- (transient-prefix-object)))
- (scope (and prefix (fboundp 'eieio-oref)
- (eieio-oref prefix 'scope))))
- (when (or args scope)
- (concat (string-join (append scope args) " ") " "))))
- 'kubed-kubectl-command-history)))
+ (let* ((args (kubed-transient-args))
+ (prefix (and (fboundp 'transient-prefix-object)
+ (transient-prefix-object)))
+ (scope (and prefix (fboundp 'eieio-oref)
+ (eieio-oref prefix 'scope))))
+ (when (or args scope)
+ (concat (string-join (append scope args) " ") " "))))))
(shell-command command))
;;;###autoload (autoload 'kubed-prefix-map "kubed" nil t 'keymap)
- [elpa] externals/kubed 667ccdb4a2 27/70: New commands for creating jobs from cronjobs, (continued)
- [elpa] externals/kubed 667ccdb4a2 27/70: New commands for creating jobs from cronjobs, ELPA Syncer, 2024/08/06
- [elpa] externals/kubed 144e0cf167 32/70: New command 'kubed-watch-deployment-status', ELPA Syncer, 2024/08/06
- [elpa] externals/kubed bd3ebf3827 37/70: New command 'kubed-list-set-filter' in list buffers, ELPA Syncer, 2024/08/06
- [elpa] externals/kubed 2f062f5175 44/70: Document a couple more 'tabulated-list-mode' commands, ELPA Syncer, 2024/08/06
- [elpa] externals/kubed 83e71ecb32 42/70: New commands for table navigation, ELPA Syncer, 2024/08/06
- [elpa] externals/kubed 6c8dabc369 47/70: New user option 'kubed-list-filter-operator-alist', ELPA Syncer, 2024/08/06
- [elpa] externals/kubed bccc588b20 39/70: ; * kubed.el (kubed-list-read-filter): Fix typo., ELPA Syncer, 2024/08/06
- [elpa] externals/kubed 7c75a19dd4 48/70: (List Filter): Document 'kubed-list-filter-operator-alist', ELPA Syncer, 2024/08/06
- [elpa] externals/kubed 7c46d70a61 49/70: Update NEWS.org and bump version to 0.2.0, ELPA Syncer, 2024/08/06
- [elpa] externals/kubed eb966a2aed 51/70: New command 'kubed-list-copy-as-kill', ELPA Syncer, 2024/08/06
- [elpa] externals/kubed 238f38c847 52/70: New commands that run kubectl with resource at point as arg,
ELPA Syncer <=
- [elpa] externals/kubed 98ad4e1b53 56/70: ; Move some user option definitions together, ELPA Syncer, 2024/08/06
- [elpa] externals/kubed 9afecde975 60/70: ; Tweak autoloading for transients, ELPA Syncer, 2024/08/06
- [elpa] externals/kubed df1cf34e37 58/70: New transient menu for displaying resources, ELPA Syncer, 2024/08/06
- [elpa] externals/kubed 5899ab69b0 63/70: Support bookmarking resource list buffers, ELPA Syncer, 2024/08/06
- [elpa] externals/kubed 25c79c51bf 66/70: ; Update NEWS.org and bump version to 0.3.0, ELPA Syncer, 2024/08/06
- [elpa] externals/kubed 2b54fa59cc 67/70: ; (kubed-display-resource-jump-to-list): Simplify., ELPA Syncer, 2024/08/06
- [elpa] externals/kubed f65ee0e44a 70/70: Update installation instructions following inclusion in ELPA, ELPA Syncer, 2024/08/06