planck

Planck ClojureScript REPL
2016-11-08T11:49:47.000425Z

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.

2016-11-08T11:50:51.000426Z

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.

anmonteiro 2016-11-08T11:51:56.000427Z

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

2016-11-08T11:53:46.000429Z

@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!

2016-11-08T11:54:41.000431Z

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

anmonteiro 2016-11-08T11:55:08.000432Z

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

anmonteiro 2016-11-08T11:55:09.000433Z

sorry

2016-11-08T11:55:44.000434Z

thanks anyway 🙂

2016-11-08T12:01:41.000435Z

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

anmonteiro 2016-11-08T12:02:12.000436Z

I suppose I'll see you tomorrow then 🙂

2016-11-08T12:05:01.000437Z

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

2016-11-08T12:11:32.000438Z

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.

2016-11-08T12:13:20.000439Z

OK, got it:

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

2016-11-08T12:15:02.000440Z

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.