dhylands / rshell

Remote Shell for MicroPython
MIT License
941 stars 133 forks source link

Proposal: run command to improve development livecycle #63

Open mchobby opened 5 years ago

mchobby commented 5 years ago

I would like to suggest the "run" command for rshell. The purpose would be to "run" a named filename already stored on the pyboard and grab the results into rshell session. There is a good reason for this request, please read here under. This would be kindly useful for development/testing life cycle (mostly for ESP8266 where only the serial connexion is available).

Why this?

On regular base, I turn some code into a lib file (name it modio.py) and I test it with a test.py script. So I write the files on my laptops, copy them to the board with Rshell cp command then start a REPL under RShell and key-in "import test" to load and execute the test file. When Getting error (or need to complete with other tests) , I exit REPL, change the files copy them again on the board, restart REPL, importing test.py and so on and so on. It would be so nice to just copy the file to the board with "cp" then test it "run" command (the run command should issue a import "the_filename" into the REPL session.

mchobby commented 5 years ago

I partially find the solution but it does not complete my request. Indeed repl pyboard import test ~ is unable to RESET the REPL context (issuing a Ctrl-D). I also noticed that many of my print() statement are not displayed in the RShell session.

May be would it be great to use ~D to issue a Ctrl-D ... So we could write repl pyboard ~D import test ~

I'm also concerned about the other print() I doesn't see on the rshell screen.

dhylands commented 5 years ago

Adding support for a run command seems like it should work. I'd like to do it so that you can use files either on the pyboard, or on the host (in which case it would behave much like pyboard.py already does).

There are potentially some issues with timeouts and pyboard.py related to the ESP32 reported elsewhere in the rshell repo.

Since I now have some ESP32 boards, I should be able to take a look at this.

mchobby commented 5 years ago

Hi Dave, Thank for your interest in this proposal. Indeed, it make sense to support the both use cases (file on the computer and file already stored on the board).

Regards, Dominique