Add run-command recipe for project script files

This commit is contained in:
Jeremy Dormitzer 2022-05-05 14:21:40 -04:00
parent a67e30d0dd
commit a2e0b17332

View File

@ -330,6 +330,24 @@
:working-dir rake-dir))
cmds)))
(defvar run-command-recipe-scripts--script-dirs '("." "bin" "scripts"))
(defun run-command-recipe-scripts ()
(let* ((root-dir (expand-file-name (or (projectile-project-root) default-directory)))
(shell (or (getenv "SHELL") "/usr/bin/env bash"))
(scripts (-mapcat
(lambda (dir)
(let ((dir (f-join root-dir dir)))
(when (f-dir? dir)
(f-files dir #'file-executable-p))))
run-command-recipe-scripts--script-dirs)))
(-map
(lambda (file)
(list :command-name (f-relative file root-dir)
:command-line file
:working-dir root-dir))
scripts)))
:general
(leader-map "\"" #'run-command)
:custom
@ -350,6 +368,7 @@
run-command-recipe-pip
run-command-recipe-maven
run-command-recipe-cargo
run-command-recipe-rake)))
run-command-recipe-rake
run-command-recipe-scripts)))
(provide 'init-run-command)