rhendric · GitHub

@rhendric

In commit  03c6e6a , removing the code that mutated process.argv also
removed a side effect that prevented all arguments to lsc from being
handled as scripts to compile and run. This caused a regression when
running `lsc script-file.ls arg1 arg2` that would result in a crash when
no `arg1.ls` file could be found.
The regression is fixed by reintroducing the side effect to remove all
but the first positional argument from the array containing the scripts
to compile and run, but only when lsc is running scripts--batch
compilation commands involving multiple input files should remain
unaffected.
This commit also adds a `process.argv.lsc` property, present only when a
script is being interpreted by lsc, which is an array holding the name
of the script being invoked along with any extra arguments not consumed
by lsc. The intent here is to provide a way to get script arguments
that's simpler and more reliable than picking through process.argv and
skipping over elements like node, the lsc compiler itself, and any CLI
options being provided to either.

Read the original on github.com ↗