Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: get and rm multiple files #107

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mikebentley15
Copy link

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 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.

  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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant