tools/mpremote: Print nicer errors for unsupported 'cp -r' arguments.

Also document support for 'cp :a :b'.

Signed-off-by: Damien George <damien@micropython.org>
pull/9091/head
Damien George 2022-08-24 10:33:11 +10:00
rodzic f5fedf4676
commit 2e386bcf76
2 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -262,6 +262,8 @@ Examples
mpremote cp main.py :
mpremote cp :a.py :b.py
mpremote cp -r dir/ :
mpremote cp a.py b.py : + repl

Wyświetl plik

@ -333,10 +333,15 @@ def do_filesystem(pyb, args):
if fs_args[0] == "cp" and fs_args[1] == "-r":
fs_args.pop(0)
fs_args.pop(0)
assert fs_args[-1] == ":"
if fs_args[-1] != ":":
print(f"{_PROG}: 'cp -r' destination must be ':'")
sys.exit(1)
fs_args.pop()
src_files = []
for path in fs_args:
if path.startswith(":"):
print(f"{_PROG}: 'cp -r' source files must be local")
sys.exit(1)
_list_recursive(src_files, path)
known_dirs = {""}
pyb.exec_("import uos")