From: Eshel Yaron Date: Wed, 24 Jul 2024 05:37:07 +0000 (+0200) Subject: kubed-transient.el: New file X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d80586f8e634e226b5a9fbe9e2e6d4508511b15a;p=emacs.git kubed-transient.el: New file --- diff --git a/lisp/net/kubed-transient.el b/lisp/net/kubed-transient.el new file mode 100644 index 00000000000..8d47d5f9222 --- /dev/null +++ b/lisp/net/kubed-transient.el @@ -0,0 +1,56 @@ +;;; kubed-transient.el --- Kubernetes transient menus -*- lexical-binding: t; -*- + +;; Copyright (C) 2024 Eshel Yaron + +;; Author: Eshel Yaron +;; Keywords: tools + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Commentary: + +;; This library extends Kubed with transient menus for various +;; Kubernetes operations. + +;;; Code: + +(require 'kubed) +(require 'transient) + +(defclass kubed-transient-infix (transient-infix) ()) + +(defun kubed-transient-read-namespace (prompt _initial-input _history) + "Prompt with PROMPT for Kubernetes namespace." + (kubed-read-namespace prompt (kubed-current-namespace))) + +;;;###autoload +(transient-define-prefix kubed-transient-create-deployment () + "Create deployment." + ["Options" + ("-n" "Namespace" "--namespace=" + :prompt "Namespace" :reader kubed-transient-read-namespace) + ("-r" "Replicas" "--replicas=" + :prompt "Number of replicas: " :reader transient-read-number-N+) + ("-i" "Image" "--image=" + :prompt "Images to deploy: " + :multi-value repeat) + ("-p" "Port" "--port=" + :prompt "Port to expose: " :reader transient-read-number-N+) + ("--" "Command" "-- =" + :prompt "Command: ")] + ["" + ("c" "Create" kubed-create-deployment)]) + +(provide 'kubed-transient) +;;; kubed-transient.el ends here