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>
This commit is contained in:
parent
f5fedf4676
commit
2e386bcf76
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue