From d80586f8e634e226b5a9fbe9e2e6d4508511b15a Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Wed, 24 Jul 2024 07:37:07 +0200 Subject: [PATCH] kubed-transient.el: New file --- lisp/net/kubed-transient.el | 56 +++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 lisp/net/kubed-transient.el 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 -- 2.39.2