Add rake run-command recipe

This commit is contained in:
Jeremy Dormitzer 2022-04-25 13:46:35 -04:00
parent 4500cf9cb5
commit b114fd0d71

View File

@ -313,6 +313,20 @@
:command-line "cargo build --release"
:working-dir project-dir)))))
(defun run-command-recipe-rake ()
(when-let* ((rake-dir (or (locate-dominating-file default-directory "Rakefile")
(locate-dominating-file default-directory "Rakefile.rb")))
(cmds (->> (shell-command-to-string "rake -T")
(s-split "\n")
(-map (lambda (s) (s-split-up-to " " s 2)))
(-map (lambda (l) (s-join " " (-take 2 l))))
(-filter (-not 'string-empty-p)))))
(-map (lambda (cmd)
(list :command-name (cadr (s-split " " cmd))
:command-line cmd
:working-dir rake-dir))
cmds)))
:general
(leader-map "\"" #'run-command)
:custom
@ -332,6 +346,7 @@
run-command-recipe-web-ext
run-command-recipe-pip
run-command-recipe-maven
run-command-recipe-cargo)))
run-command-recipe-cargo
run-command-recipe-rake)))
(provide 'init-run-command)