platformsh / legacy-cli

This is the legacy version of Platform.sh's command-line interface. The new version is at: https://github.com/platformsh/cli
https://docs.platform.sh/administration/cli.html
MIT License
221 stars 120 forks source link

--exclude/--include for platform mount:download and platform mound:download #650

Closed tylers-username closed 6 years ago

tylers-username commented 6 years ago

Feature suggestion

Add ability to include or exclude files when uploading to or downloading from a mount.

Use case

As a developer, I need to downloading my media directory and exclude cached images.

Suggested command format

Implementing Symfony Consoles InputOption::VALUE_IS_ARRAY:

platform mount:download -y -m media --target media --exclude="catalog/product/cache" --exclude="wysiwyg/thumbnails/cache"

Contributing

I am happy to develop this feature, but before I get down and dirty I'd like to ensure (1) that it is needed and (2) how Platform.sh prefers it to be implemented.

pjcdawkins commented 6 years ago

I'm happy with --exclude because you've presented a use case, but I'm not sure --include is also necessary. I would want to avoid these mount commands being too complex. "Power users" can use things like "rsync "$(platform ssh --pipe)":foo bar" directly if necessary.

By the way, rsync accepts patterns like this:

platform mount:download -y --mount media --target media --exclude '**/cache'
pjcdawkins commented 6 years ago

... well I just experimented quickly and ended up adding both options in the PR above

tylers-username commented 6 years ago

Thanks for the perspective and for taking action. I'll play with your pull request on the development branch. I expect this to be very useful when it comes to minimizing time to download mounts.

pjcdawkins commented 6 years ago

No need to use development, it's deployed in v3.23.0 :)