~vdemeester/home

d06ae5cf8a4f734cf8ec26f334b3ea9bb4507333 — Vincent Demeester 7 days ago 5869a88
tools/emacs: custom project enhancements

Update the package command(s) for ko project types.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 files changed, 12 insertions(+), 2 deletions(-)

M tools/emacs/config/config-projects.el
M tools/emacs/config/config-projects.el => tools/emacs/config/config-projects.el +12 -2
@@ 132,10 132,20 @@
           (relative-current-folder (file-name-directory relative-current-file)))
      (cond
       ((string-prefix-p "cmd/" relative-current-file) (format "go run ./%s" relative-current-folder)))))
  
  (defun projectile-ko-package-command ()
    "define a package command for a ko project, depending on the openend file "
    "ko resolve --push=false --oci-layout-path=/tmp/oci -f config")
    (cond
     ((eq major-mode 'go-mode) (projectile-ko-package-command-go))
     (t "ko resolve --push=false --oci-layout-path=/tmp/oci -f config")
     ))
  
  (defun projectile-ko-package-command-go ()
    "package command for a ko project if in a go file"
    (let* ((current-file (buffer-file-name (current-buffer)))
           (relative-current-file (file-relative-name current-file (projectile-project-root)))
           (relative-current-folder (file-name-directory relative-current-file)))
      (cond
       ((string-prefix-p "cmd/" relative-current-file) (format "ko publish --push=false ./%s" relative-current-folder)))))
  (defun projectile-ko-install-command ()
    "define a install command for a ko project, depending on the openend file "
    "ko apply -f config/")