home

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit d06ae5cf8a4f734cf8ec26f334b3ea9bb4507333
parent 5869a8804c1bb40dc41054d9e1630401afbd5641
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Fri, 11 Sep 2020 17:41:44 +0100

tools/emacs: custom project enhancements

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

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Mtools/emacs/config/config-projects.el | 14++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/tools/emacs/config/config-projects.el b/tools/emacs/config/config-projects.el @@ -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/")