diff --git a/emacs/.emacs.d/config/init-run-command.el b/emacs/.emacs.d/config/init-run-command.el index d4efc02..6a42357 100644 --- a/emacs/.emacs.d/config/init-run-command.el +++ b/emacs/.emacs.d/config/init-run-command.el @@ -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)