juliangruber / browser-run

Run code inside a browser from the command line
447 stars 62 forks source link

Pass command line arguments to the running script #29

Closed neojski closed 9 years ago

neojski commented 9 years ago

It would be nice if I could say:

browser-run -b chrome whatever

And then see the whatever part in the script somehow. Maybe as process.argv?

juliangruber commented 9 years ago

you could use https://github.com/hughsk/envify like so:

$ echo "console.log(process.env.FOO + process.env.BAR)"
  | FOO=foo BAR=bar envify
  | browser-run -b chrome
foobar

does that work for you?

neojski commented 9 years ago

Cool, thanks!