espruino / EspruinoTools

JavaScript library of tools for Espruino - used for the Web IDE, CLI, etc.
Apache License 2.0
150 stars 89 forks source link

Save on Send option? #139

Closed RobertSmart closed 2 years ago

RobertSmart commented 2 years ago

Hi,

Is there a way to enable a save on send function through the cmd line args?

I noticed there was an option in the job file for save on send which might be useable, but I also upload files to storage and can't see this option in the job file anywhere?

Thanks,

Rob

gfwilliams commented 2 years ago

There are some examples in the README (https://github.com/espruino/EspruinoTools) like:

# Write mycode.js to the first Bangle.js device found as a Storage file named app.js
espruino -d Bangle.js mycode.js --storage app.js:-

But I'm not sure if you can specify that from the job file yet

RobertSmart commented 2 years ago

Hi,

Thanks for the reply. Will it automatically run app.js on startup? Am I right in assuming in this instance you don't need to use the onInit function, as the whole file will be read from flash and executed?

Thanks again!

gfwilliams commented 2 years ago

You need to use --storage .bootcde:- for it to run at startup.

If you're doing that then you can just do --config SAVE_ON_SEND=1. See espruino --listconfigs for more info. That one is available in the job file.

in this instance you don't need to use the onInit function, as the whole file will be read from flash and executed?

That's correct, yes.