@@ -300,6 +300,19 @@ def show_progress_bar(size, total_size):
300300 )
301301
302302
303+ # Get all args up to the terminator ("+").
304+ # The passed args will be updated with these ones removed.
305+ def get_fs_args (args ):
306+ n = 0
307+ for src in args :
308+ if src == "+" :
309+ break
310+ n += 1
311+ fs_args = args [:n ]
312+ args [:] = args [n + 1 :]
313+ return fs_args
314+
315+
303316def do_filesystem (pyb , args ):
304317 def _list_recursive (files , path ):
305318 if os .path .isdir (path ):
@@ -308,16 +321,18 @@ def _list_recursive(files, path):
308321 else :
309322 files .append (os .path .split (path ))
310323
324+ fs_args = get_fs_args (args )
325+
311326 # Don't be verbose when using cat, so output can be redirected to something.
312- verbose = args [0 ] != "cat"
327+ verbose = fs_args [0 ] != "cat"
313328
314- if args [0 ] == "cp" and args [1 ] == "-r" :
315- args .pop (0 )
316- args .pop (0 )
317- assert args [- 1 ] == ":"
318- args .pop ()
329+ if fs_args [0 ] == "cp" and fs_args [1 ] == "-r" :
330+ fs_args .pop (0 )
331+ fs_args .pop (0 )
332+ assert fs_args [- 1 ] == ":"
333+ fs_args .pop ()
319334 src_files = []
320- for path in args :
335+ for path in fs_args :
321336 _list_recursive (src_files , path )
322337 known_dirs = {"" }
323338 pyb .exec_ ("import uos" )
@@ -335,8 +350,9 @@ def _list_recursive(files, path):
335350 verbose = verbose ,
336351 )
337352 else :
338- pyboard .filesystem_command (pyb , args , progress_callback = show_progress_bar , verbose = verbose )
339- args .clear ()
353+ pyboard .filesystem_command (
354+ pyb , fs_args , progress_callback = show_progress_bar , verbose = verbose
355+ )
340356
341357
342358def do_repl_main_loop (pyb , console_in , console_out_write , * , code_to_inject , file_to_inject ):
0 commit comments