gkz / LiveScript

LiveScript is a language which compiles to JavaScript. It has a straightforward mapping to JavaScript and allows you to write expressive code devoid of repetitive boilerplate. While LiveScript adds many features to assist in functional style programming, it also has many improvements for object oriented and imperative programming.
http://livescript.net
MIT License
2.32k stars 155 forks source link

passing command line arguments to lsc executable still not working? #1013

Closed ghost closed 6 years ago

ghost commented 6 years ago

my apologies if i am being stupid, but i can not manage to pass arguments to a #!/usr/bin/env lsc executable on the command line, as lsc attempts to read them as additional input files

my expected behavior was for any arguments after the input file to be passed onto the script and available with process.argv

i have tried with -- as suggested in #610, and i have been reading similar issues (#569, #587, #589, etc) to find a solution to no avail

any guidance would be appreciated.

rhendric commented 6 years ago

Would you please share:

ghost commented 6 years ago

at shell i am running ~lsc temp.lsc arg1 arg2

rhendric commented 6 years ago

The code you pasted doesn't compile with lsc 1.5.0 (try it on http://livescript.net/). Either that's not literally the code you've been trying to run, or maybe you have a rather old lsc hanging around somewhere?

ghost commented 6 years ago

my fault, this is the correct code: for arg in process.argv then console.log arg

it still would not work on livescript.net since process is not accessible

rhendric commented 6 years ago

I'm not sure what's going wrong for you. Here's me running that same code in a fresh Docker container with Node 9.4 and LiveScript 1.5:

% docker run -it --rm node:9.4 bash
root@1fab59a7aae2:/# npm install -g livescript
/usr/local/bin/lsc -> /usr/local/lib/node_modules/livescript/bin/lsc
+ livescript@1.5.0
added 9 packages in 1.07s
root@1fab59a7aae2:/# cat > temp.ls
for arg in process.argv
    console.log arg
root@1fab59a7aae2:/# lsc temp.ls arg1 arg2
/usr/local/bin/lsc
/temp.ls
arg1
arg2
root@1fab59a7aae2:/# 
ghost commented 6 years ago

huh that's weird. running it by itself im getting

/usr/bin/node
/home/jzeus/repo/etc/livescript/bin/lsc
temp.lsc

but you are not getting the node as an argument? i noticed that you actually mention this in #916 and have made a commit to fix it, but somehow this is not working for me. i pulled the latest version of the repo and tried with different shells...

rhendric commented 6 years ago

Ahhh, you're running LiveScript from master, not the published version? I can reproduce the issue on master.

If running published 1.5.0 is an option for you, I would recommend that as a workaround until I get this sorted out.

ghost commented 6 years ago

yea i started compiling from master when i realized the published version did not have a fix in place for await

rhendric commented 6 years ago

Well, since you're already hanging out on the bleeding edge, you can take the fix/LiveScript-1013 branch of my fork for a spin and see if that works for you. My usual approach is to wait around a week for community feedback before merging most changes to master here, so if you're impatient for a fix, that's the thing to do.

ghost commented 6 years ago

sweet

do you mind me asking where the community feedback takes place? i want to get more involved with livescript development if possible

rhendric commented 6 years ago

Right here on GitHub, for the most part. I'm not generally on IRC unless I'm asked to be, but some people hang out in a #livescript channel on Freenode as well.

ghost commented 6 years ago

ah i see you made a pull request, i appreciate the quick fix

hoping to start reading through livescript code, i have been looking for a project to contribute to and i have been loving ls so far