lumo

:lumo: Standalone ClojureScript environment. Currently at version 1.9.0
richiardiandrea 2017-08-22T15:24:14.000318Z

I have the following, but I see :

(defn ^:export -main [& args]
  (.log js/console cljs.core/*command-line-args*))
but *command-line-args* is always null, am I doing anything wrong? Lumo is 1.7.0

richiardiandrea 2017-08-22T15:40:32.000401Z

I read that command-line-args is bound only in repl is that true? I know I can use process.argv but I was wondering if I need to open an issue

dominicm 2017-08-22T15:41:53.000301Z

process.argv is kinda meh in lumo because it includes lumo itself. (iirc)

richiardiandrea 2017-08-22T15:44:30.000010Z

yeah I have just tried and you are exactly right

anmonteiro 2017-08-22T15:51:20.000031Z

Argv will also include "node" in Node.js

anmonteiro 2017-08-22T15:51:31.000648Z

There might be a but wrt command line args

anmonteiro 2017-08-22T15:51:38.000264Z

Idk

richiardiandrea 2017-08-22T15:53:35.000046Z

process.argv includes two items that are not the arguments by default

anmonteiro 2017-08-22T15:54:04.000350Z

There's a bug right here

richiardiandrea 2017-08-22T15:54:06.000207Z

but @dominicm is right, if I use it in lumo it will include lumo args as well

richiardiandrea 2017-08-22T15:54:23.000456Z

here you go

richiardiandrea 2017-08-22T15:54:52.000387Z

I was grepping for command-line-args and could not understand why I could not find it 😄

anmonteiro 2017-08-22T15:54:53.000101Z

We switched yo cljs.core/*command-line-args*

anmonteiro 2017-08-22T15:55:01.000263Z

To*

richiardiandrea 2017-08-22T15:55:02.000007Z

yes, I will push a PR, thanks!

anmonteiro 2017-08-22T15:55:08.000044Z

Thank you

richiardiandrea 2017-08-22T15:57:37.000436Z

I was also looking at the other PR, I will need to ask you something as well, in a bit 😉

anmonteiro 2017-08-22T16:00:02.000608Z

Sure

richiardiandrea 2017-08-22T16:44:08.000459Z

@anmonteiro when you have time, I have an error here a bit difficult to understand for me https://github.com/anmonteiro/lumo/pull/238

anmonteiro 2017-08-22T17:22:41.000150Z

@richiardiandrea so the reason you’re getting an error is because you never initialize the CLJS engine

richiardiandrea 2017-08-22T17:23:42.000457Z

oh yeah, I was trying the suggestion of the comments and it still did not work, it is probably the init issue then

anmonteiro 2017-08-22T17:30:44.000272Z

@richiardiandrea that’s also not the place where you wanna add the code

anmonteiro 2017-08-22T17:30:51.000386Z

because we check for repl below

richiardiandrea 2017-08-22T17:31:34.000192Z

yep good we are discussing this, I was thinking about it...I guess this feature is valid also for non-repl usage

richiardiandrea 2017-08-22T17:31:44.000009Z

actually especially for non-repl usage

anmonteiro 2017-08-22T17:32:01.000217Z

@richiardiandrea this is only for non-REPL usage

richiardiandrea 2017-08-22T17:32:39.000338Z

yep, so we don't want to put it in if (repl)...where do you suggest we put it...I put it there because it is alternative to -m

anmonteiro 2017-08-22T17:33:05.000083Z

I didn’t suggest to put it in that if statement

anmonteiro 2017-08-22T17:33:16.000302Z

I suggested to place it in the else condition of that if statement

richiardiandrea 2017-08-22T17:33:33.000169Z

but maybe it should be also checking if (!repl)

richiardiandrea 2017-08-22T17:33:37.000737Z

yeah ok

anmonteiro 2017-08-22T17:33:45.000392Z

we’ll be there if !mainNsName && !repl

richiardiandrea 2017-08-22T17:33:45.000459Z

same thought

anmonteiro 2017-08-22T17:38:39.000208Z

@richiardiandrea does *command-line-args* work with your fix?

richiardiandrea 2017-08-22T17:38:47.000241Z

yes

richiardiandrea 2017-08-22T17:38:55.000458Z

tnx for the suggestion 😉

anmonteiro 2017-08-22T17:39:35.000216Z

I think we can now add tests for that too

anmonteiro 2017-08-22T17:39:39.000139Z

since we run tests in Lumo

richiardiandrea 2017-08-22T17:40:03.000476Z

successfully passing (cli-options (clj->js *command-line-args*)) and posix-getopts is happy

richiardiandrea 2017-08-22T17:40:31.000418Z

the only thing I need is to set optind to 0

anmonteiro 2017-08-22T17:40:33.000691Z

^ this namespace is the entry point for Lumo tests

richiardiandrea 2017-08-22T17:40:53.000263Z

checking

anmonteiro 2017-08-22T17:41:02.000361Z

so we can add Lumo-specific unit tests and require them from there

anmonteiro 2017-08-22T17:41:33.000006Z

or even add unit tests in the other files and run them if test-util/lumo-env?

richiardiandrea 2017-08-22T17:42:16.000003Z

oh I contributed to that already ah ah 😄 will do my best

anmonteiro 2017-08-22T17:42:23.000284Z

thanks!

anmonteiro 2017-08-22T17:48:40.000137Z

@richiardiandrea for your current use case it would be just a matter of adding cli opts here https://github.com/anmonteiro/lumo/blob/master/circle.yml#L54

anmonteiro 2017-08-22T17:48:52.000070Z

or even abstract that away in a common script that you call from the other ci scripts

richiardiandrea 2017-08-22T17:50:47.000438Z

I guess that would be more of an integration test (that should be done), then I was thinking of setting *command-line-args* in a fixture or something for unit testing

richiardiandrea 2017-08-22T18:01:40.000715Z

ah! the other patch does not work either...I am investigating why:

~/git/lumo/build/lumo scripts/lumo/build.cljs 
             ⬆
WARNING: No such namespace: lumo.repl, could not locate lumo/repl.cljs, lumo/repl.cljc, or JavaScript source providing "lumo.repl" at line 1 
             ⬆
WARNING: Use of undeclared Var lumo.repl/run-main-cli-fn at line 1 
command line arguments are required.
brb

richiardiandrea 2017-08-22T18:44:42.000309Z

k solved and pushed the changes

richiardiandrea 2017-08-22T18:47:07.000492Z

about the cli args, I think the only useful test is the one you are hinting at, an integration test from command line invocation...I don't see the point in testing something else

anmonteiro 2017-08-22T18:50:14.000515Z

agreed

anmonteiro 2017-08-22T18:50:20.000457Z

we can punt on that for now too

anmonteiro 2017-08-22T18:50:39.000265Z

I’ve been meaning to set up integration tests but haven’t found time to do it yet

anmonteiro 2017-08-22T18:51:19.000425Z

@richiardiandrea if that’s something you’d like to contribute, I’m open to ideas

👍 1
richiardiandrea 2017-08-22T18:52:08.000451Z

definitely something interesting to think about

anmonteiro 2017-08-22T18:52:19.000242Z

there are some linting issues in your PR that’s why CI is failing

anmonteiro 2017-08-22T18:52:26.000345Z

@richiardiandrea just running yarn prettier should fix them

anmonteiro 2017-08-22T18:52:34.000566Z

or npm run prettier

richiardiandrea 2017-08-22T18:52:52.000667Z

k

richiardiandrea 2017-08-22T18:53:39.000284Z

lol why is it adding a comma before a closing paren?

richiardiandrea 2017-08-22T18:53:48.000120Z

I thought it was a typo and removed it

anmonteiro 2017-08-22T18:54:25.000477Z

in ES6 trailing commas before closing parens are valid

anmonteiro 2017-08-22T18:54:51.000340Z

(which is how you tell that TC-39 is really focusing on important issues)

😅 1
anmonteiro 2017-08-22T18:55:15.000130Z

🙃

dominicm 2017-08-22T19:27:35.000366Z

I mean, that it wasn't confuses me

dominicm 2017-08-22T19:28:04.000298Z

Death by semicolons I guess

dominicm 2017-08-22T19:28:13.000271Z

lisp is so freeing

michaelwfogleman 2017-08-22T19:41:33.000034Z

@anmonteiro @richiardiandrea I just started trying some basic scripts with Lumo - am I understanding that command-line-args is currently not functioning, but PR 237 will fix that?

richiardiandrea 2017-08-22T19:41:53.000375Z

@michaelwfogleman that's exactly right

michaelwfogleman 2017-08-22T19:42:14.000564Z

OK, thought I was doing something dumb 😛

richiardiandrea 2017-08-22T19:42:58.000249Z

if tests are going through and Antonio has time for that, a 1.7.1 might be good. Or master.

anmonteiro 2017-08-22T19:55:13.000346Z

@michaelwfogleman once I merge that PR you can brew install --HEAD lumo if you’re on a mac

anmonteiro 2017-08-22T19:55:51.000393Z

this is a bad enough bug that warrants cutting a 1.7.1 release

anmonteiro 2017-08-22T20:50:06.000069Z

@richiardiandrea just wrap that entire deftest in an if or something

richiardiandrea 2017-08-22T20:50:36.000111Z

done that, waiting for the results

anmonteiro 2017-08-22T20:54:03.000533Z

thanks

anmonteiro 2017-08-22T20:54:46.000248Z

does that work locally?

richiardiandrea 2017-08-22T20:59:18.000169Z

@anmonteiro yes it works

richiardiandrea 2017-08-22T21:23:21.000283Z

awesome all green :partywombat:

anmonteiro 2017-08-22T21:45:48.000049Z

@richiardiandrea tests are failing

richiardiandrea 2017-08-22T22:04:10.000028Z

Added things to both Travis and AppVeyor confs...did not know you had three...that's good, this should now complete fine

anmonteiro 2017-08-22T22:09:08.000146Z

ah cool, missed that