Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deftask macro: missing arguments #487

Closed
pesterhazy opened this issue Jul 31, 2016 · 3 comments
Closed

deftask macro: missing arguments #487

pesterhazy opened this issue Jul 31, 2016 · 3 comments

Comments

@pesterhazy
Copy link
Contributor

When deftask is called without a an argument vector in build.boot, the following exception is thrown:

cli: expected short option, got println
cli: expected long option, got nil
cli: option nil: expected optarg, got "foo"
 clojure.lang.ExceptionInfo: Wrong number of args (1) passed to: cli/argspec->cli-argspec
    data: {:file
           "/var/folders/rj/8lnf662s3mlgzv5mcq2r2fnc0000gn/T/boot.user7782529942334603268.clj",
           :line 23}
clojure.lang.ArityException: Wrong number of args (1) passed to: cli/argspec->cli-argspec
               ...
boot.main/-main/fn     main.clj: 196
   boot.main/-main     main.clj: 196
               ...
  boot.App.runBoot     App.java: 399
     boot.App.main     App.java: 488
               ...
  boot.Loader.main  Loader.java: 253

An example:

(deftask foo (println "foo"))

A better user experience would be an exception with the message "Parameter declaration "println" should be a vector." (which is what defn throws). I think clojure.spec could help though I'm not sure boot can rely on clojure 1.9 anytime soon.

Another problem is that the line numbers displayed in the exception do not correspond to the faulty lines in build.boot, so you need to guess which definition contains the syntax error.

@micha
Copy link
Contributor

micha commented Jul 31, 2016

@pesterhazy Why do you say the line numbers don't correspond to the correct lines in build.boot? Are you using -v both when you run the boot command that fails and when you look at the generated script?

For example:

$ boot -v mytask
cli: expected short option, got println
cli: expected long option, got nil
cli: option nil: expected optarg, got "foo"
 clojure.lang.ExceptionInfo: Wrong number of args (1) passed to: cli/argspec->cli-argspec
    data: {:file
           "/var/folders/rj/8lnf662s3mlgzv5mcq2r2fnc0000gn/T/boot.user7782529942334603268.clj",
           :line 23}
clojure.lang.ArityException: Wrong number of args (1) passed to: cli/argspec->cli-argspec
               ...
boot.main/-main/fn     main.clj: 196
   boot.main/-main     main.clj: 196
               ...
  boot.App.runBoot     App.java: 399
     boot.App.main     App.java: 488
               ...
  boot.Loader.main  Loader.java: 253
$ boot -vb mytask |cat -n
     1  (ns boot.user
     2    (:use boot.core boot.util boot.task.built-in))
     3
     4  ;; start boot script
...

@micha
Copy link
Contributor

micha commented Jul 31, 2016

The -v option pretty-prints the generated script, so the line numbers will be different if you run it with and without -v.

@micha micha closed this as completed in 40a132c Jul 31, 2016
@pesterhazy
Copy link
Contributor Author

That was ⚡ fast! I didn't know about the -b option, that's useful for debugging, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants