jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
8.28k stars 219 forks source link

Support configuring tasks scripts with more languages #2185

Open lugoues opened 1 month ago

lugoues commented 1 month ago

Currently the only way that configuration is captured from a task script is if it matches [^# mise ([a-z]+=.+)$](https://github.com/jdx/mise/blob/70f4b95be783ee297c8ecc234446b8b08612d5f7/src/task.rs#L80]. This restricts scripts to only languages that use a single# as their comment indicator.

One possible solution I had in mind, and wanted feedback prior to opening a PR, would be to change the line capture so it stops once it hits a blank line and change the regex capture to .* # mise ([a-z]+=.+)$. This should keep it backwards compatible.

For example:

#!/usr/bin/env -S mise x babashka -- bb
;; # mise description="My awesome task"

(println "do things")

Thoughts?