boot-clj / boot

Build tooling for Clojure.
https://boot-clj.github.io/
Eclipse Public License 1.0
1.75k stars 180 forks source link

add a warning when the repl tasks :eval option is passed a string #666

Closed martinklepsch closed 6 years ago

martinklepsch commented 6 years ago

Currently this works:

boot repl -c -e '(println "hello")'

but this doesn't despite being the obvious "translation" of the above.

(deftask connect
  []
  (repl :client true
        :eval "(println \"hello\")"))

What's expected in this case is a quoted form; a string is just evaluated as a string essentially not doing anything:

(deftask connect
  []
  (repl :client true
        :eval '(println "hello")))

The change in this PR prints a warning if a user passes a string instead of a quoted form in Clojure code / build.boot:

When passing :eval to the repl task in your build.boot, use a quoted form instead of a string

I considered just using read-string but a warning seems fair and might also educate the user about the differences when passing edn options via the CLI vs. Clojure code.

Considered adding a Changelog entry but didn't really seem interesting enough.

martinklepsch commented 6 years ago

Thanks for the review @arichiardi!

I think ultimately we should consider a form option type that will only accept Clojure forms a la (init) and not accept anything else (i.e. as in this case: edn).