flyctl icon indicating copy to clipboard operation
flyctl copied to clipboard

feat: Make SFTP `put` command handle wildcards

Open klevente opened this issue 2 years ago • 2 comments

Update the sftp put function to resolve wildcards (like *), and upload all matched files to the container.

For now, I left the logic of not replacing the file in the container if it already exists.

For handling multiple files, I used the logic as described in the OpenSSH documentation.

local-path may contain glob(7) characters and may match multiple files. If it does and remote-path is specified, then remote-path must specify a directory.

klevente avatar May 21 '23 20:05 klevente

@kzys Yep that makes way more sense actually, as that would also enable devs to write scripts for uploading files programmatically. It'd also satisfy my use-case fully.

Just a question: I checked how fly sftp get works, and it operates on a single file as well. I'm not sure how we can let the shell expand the provided glob before passing it into fly, but I am not well-versed with Unix shell stuff to be honest.

Also, if we decide to go this route, it'd be cool to have a flag like --overwrite that overwrites any existing files in the container. WDYT?

klevente avatar May 23 '23 07:05 klevente

I came here because I would looove fly sftp put 😍 @kzys

Stumbled across this thread because fly sftp shell doesn't allow completions, or the star syntax, which taken together make using it a schlep -- adding put would probably solve

mrluc avatar Jan 23 '24 18:01 mrluc