Fork me on GitHub
#planck
<
2016-11-08
>
mhuebert11:11:47

I am really enjoying Planck. I’m working on packaging deps for use with bootstrapped cljs in the browser, and it is a huge help, both for the workflow & the many examples of working w/ the self-hosted compiler in the source.

mhuebert11:11:51

One question about loading planck scripts using #!/usr/bin/env planck — how can one pass command-line arguments to Planck? I can access the args in my script, but i also need to provide planck w/ a classpath and cache-dir.

anmonteiro11:11:56

@mhuebert I haven't tried it, but it's my understanding that you'll get them in *command-line-args*

mhuebert11:11:46

@anmonteiro command-line-args works perfectly for accessing args for my script; however, I also need to pass args to planck. eg/ in ./my-script.cljs -K, the -K arg is for planck. Pretty sure this is about my lack of unix knowledge and not planck!

mhuebert11:11:41

^ I think this is along the lines of what I’m looking at

anmonteiro11:11:08

oh, then I also have lack of UNIX knowledge to help there 🙂

mhuebert11:11:44

thanks anyway 🙂

mhuebert12:11:41

@anmonteiro and btw I’m looking forward to your talk tomorrow!

anmonteiro12:11:12

I suppose I'll see you tomorrow then 🙂

mhuebert12:11:01

hmm. This is tricky, using the idea from that link I am able to pass some args to planck, but if I pass any other unexpected args, planck throws an ‘unrecognized option’ error

mhuebert12:11:32

I can do something like this:

#!/bin/sh
":"; exec /usr/bin/env planck -i "$0" -c `lein classpath` -K
but the original command line args are lost.

mhuebert12:11:20

OK, got it:

#!/bin/sh
":"; exec /usr/bin/env planck -c `lein classpath` -K "$0" "$@“

mhuebert12:11:02

from the planck cli docs: Binds planck.core/*command-line-args* to a seq of strings containing command line args that appear after any main option. In the example above, “$0”, which is the path to the script we are running, must be passed at the end (as a naked ‘path’ option) instead of with the -i option.