scientifichackers / ampy

MicroPython Tool - Utility to interact with a MicroPython board over a serial connection.
MIT License
723 stars 157 forks source link

CLI: get and rm multiple files #107

Open mikebentley15 opened 3 years ago

mikebentley15 commented 3 years ago

Description

This change is fairly simple

Related Work

I see this is somewhat similar to pull request #88. If desired for ampy get, we could allow remote directories to be specified as well. However, I think a destination directory would need to be specified as it becomes weird to print the contents of an entire directory to standard out.

My recommendation:

Questions

One tricky folder is the root folder, which has no name.

  1. I think if multiple remote paths are specified and one of them is the root path, then that should be an error
  2. If / is specified as the only remote path, then what do we do if the destination is a currently existing directory? Here are a few options (I'm partial to solution (a)): a. Have it be an error - you must specify a directory that does not exist b. Copy all files and folders into that destination c. Create a hard-coded named directory in the destination called something like pyboard_root to copy stuff into.
  3. Would we want to add a --recursive/-r flag to indicate that we do indeed want to copy a whole directory (if specified)? Either way is fine with me.
  4. Should this additional proposed change be a separate issue / pull request?

Conclusion

This could allow for something like

ampy get -r / board_copy

to copy all files and folders and store them in a folder called board_copy