Add basic kustomize.el
This commit is contained in:
parent
c8b062d9be
commit
6c22442a00
|
@ -10,3 +10,8 @@
|
||||||
(get-buffer-create "*Writing Mode*")
|
(get-buffer-create "*Writing Mode*")
|
||||||
(switch-to-buffer "*Writing Mode*")
|
(switch-to-buffer "*Writing Mode*")
|
||||||
(org-mode))
|
(org-mode))
|
||||||
|
|
||||||
|
(setq-default
|
||||||
|
functions-file (concat (or (getenv "XDG_CONFIG_HOME") "~/.emacs.d/") "kustomize.el"))
|
||||||
|
(when (file-exists-p functions-file)
|
||||||
|
(load functions-file))
|
||||||
|
|
25
.emacs.d/kustomize.el
Normal file
25
.emacs.d/kustomize.el
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
;;; kustomize.el --- quickly test and render kustomize overlays
|
||||||
|
;; Copyright (C) 2023 Gabriel Simmer
|
||||||
|
|
||||||
|
;; Author: Gabriel Simmer <gsimmer@protonmail.com>
|
||||||
|
;; Version: 0.0.100m
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Render a Kustomization and display in a buffer.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
(defun render-kustomize (path)
|
||||||
|
(shell-command-to-string (concat "kubectl kustomize" " " path)))
|
||||||
|
|
||||||
|
(defun kustomize (&optional path) (interactive)
|
||||||
|
(or path (setq path ""))
|
||||||
|
(let ((buff (get-buffer-create "*kustomize*")))
|
||||||
|
(display-buffer buff
|
||||||
|
'(display-buffer-in-side-window . ((side . right))))
|
||||||
|
(with-current-buffer buff
|
||||||
|
(insert (format "%s" (render-kustomize path)))
|
||||||
|
(if (fboundp 'k8s-mode) (k8s-mode) (yaml-mode)))))
|
||||||
|
|
||||||
|
(provide 'kustomize)
|
||||||
|
;;; kustomize.el ends here
|
Loading…
Reference in a new issue