Closed lynaghk closed 13 years ago
Well, it is official cake policy to make breaking changes and then not update the docs. That variable was changed to just args recently. I'll talk to ninjudd later about some changes to the docs.
The variable *args*
is not defined, and I get a stacktrace. I'm using cake 0.6.0 via the rubygem.
Hm, you got me. I had this same problem last weekend and ninjudd said he'd changed it to args, but I get the same as you.
Duh. You want cake/args, not just args.
Just kidding! Pretty sure this still doesn't work. Even better, cake is still defining command-line-args in eval.clj and useful.clj, but not in the shared bindings in project.clj. I don't actually know what all that means, so I'm gonna have to talk to ninjudd about what exactly he is intending to do here with respect to this issue.
It looks like I can get to the command line arguments like so;
(:run cake/*opts*)
but it's not as nice to say as *command-line-args*
=)
Ah, well, if you want the parsed options, you want to be using opts. What used to be command-line-args and should someday hopefully be args is the unparsed version of the command line, which can be useful sometimes.
this works for me on cake 0.6.1:
fallout:~ master$ cake run foo.clj "foo bar"
(foo bar)
*args*
is the raw args passed to cake. *command-line-args*
is bound for convenience to be all *args*
after the name of the script. this change was made at the request of Raynes, and i think it makes sense.
i'm closing this. please reopen if this still doesn't work as i've described after updating to the latest cake version.
also, let me know the exact name and path of your script and the exact command being used to invoke it.
thanks
ninjudd, if I do 'cake repl -a 1 -b 2', what should args be? Because for me, it is nil.
\- David
args are not passed to the project jvm by bake. they are mostly for use in cake tasks, but you can pass them manually using bake bindings
Upgrading to 0.6.1 fixed the issue. Thanks guys!
Putting
in a file and running it with
prints
nil
. Am I missing something?