ampy rm: be able to specify any number of files (note zero files is not an error, per recommendation by Python Click)
ampy get: be able to specify a directory as the destination instead of a file
ampy get: be able to specify multiple files from the remote, which will only work if the destination is a currently existing directory.
ampy get: for one remote file, you can give - to explicitly specify writing to standard output.
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:
If a single remote directory is specified, then a destination must be required, either
an existing directory (in which the remote directory name will be created in the local existing directory), or
a non-existent path to be the path and name of the copied folder
If multiple remote paths are given, nothing changes regardless of whether one or more of them are directories. The current implementation in this pull request is that the destination must be an existing directory if multiple remote paths are specified.
Questions
One tricky folder is the root folder, which has no name.
I think if multiple remote paths are specified and one of them is the root path, then that should be an error
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.
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.
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
Description
This change is fairly simple
ampy rm
: be able to specify any number of files (note zero files is not an error, per recommendation by Python Click)ampy get
: be able to specify a directory as the destination instead of a fileampy get
: be able to specify multiple files from the remote, which will only work if the destination is a currently existing directory.ampy get
: for one remote file, you can give-
to explicitly specify writing to standard output.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.
/
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 likepyboard_root
to copy stuff into.--recursive
/-r
flag to indicate that we do indeed want to copy a whole directory (if specified)? Either way is fine with me.Conclusion
This could allow for something like
to copy all files and folders and store them in a folder called
board_copy