micropython / webrepl

WebREPL client and related tools for MicroPython
MIT License
633 stars 297 forks source link

webrepl_cli.py: Add support for accessing REPL. #66

Closed dpgeorge closed 2 years ago

dpgeorge commented 3 years ago

With this, the webrepl_cli.py script can be used to access the REPL, eg:

$ ./webrepl_cli.py -p x 192.168.4.1
op:repl, host:192.168.20.27, port:8266, passwd:x.
Remote WebREPL version: (1, 17, 0)
Use Ctrl-] to exit this shell
1/2
0.5
>>>

This is similar to #37 but simpler.

rizzak commented 2 years ago

Great! I try it, this is works! Can you add the instruction in README.md

dov commented 2 years ago

Why wasn't this merged into master yet? I'd like to merge my "command changes" (see #28) together with this pull request.

dov commented 2 years ago

@dpgeorge I thought you may be interested, that I enhanced your repl with a command mode for doing ls, get and put from the command line.

Here is a sample interaction:

./webrepl_cli.py -h 192.168.1.220
repl mode. Use Ctrl-] to exit this shell

>>>
cli [/]> ls
boot.py
main.py
webrepl_cfg.py
cli [/]> cat boot.py
# This file is executed on every boot (including wake-boot from deepsleep)
#import esp
#esp.osdebug(None)
import uos, machine
#uos.dupterm(None, 1) # disable REPL on UART(0)
import gc
import webrepl
webrepl.start()
gc.collect()

cli [/]> help
Supported commands: exit, ls, repl, get, put, del

See: http://github.com/dov/webrepl/ , master branch.

dpgeorge commented 2 years ago

Thanks @dov! I will take a look at your enhancements.

dpgeorge commented 2 years ago

This was merged.

I don't really want to support any more features for webrepl_cli.py. The next step would be to integrate the behaviour into mpremote, so mpremote would replace webrepl_cli.py.