-
Notifications
You must be signed in to change notification settings - Fork 10
Ability to upload contents of directory only without creating the parent directory in Cloudinary. #63
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
Conversation
… parent directory in Cloudinary
|
@chrissnyder2337 Thank you for the PR! It is really a good use case. |
… add a way to turn it off
|
@const-cloudinary I have changed the parameter's name to Due to the way that boolean flags work, and the desire to keep all existing functionality when the new command line option was not provided, I also needed to add a way to turn it off by adding a See https://click.palletsprojects.com/en/8.1.x/options/#boolean-flags |
|
@const-cloudinary I have updated this PR's description to reflect the change of parameters. |
|
@const-cloudinary I have just pushed an additional change to this PR to add a couple of tests and tweaked the implementation to account for a bug I found. |
|
FYI: I have updated this PR's description to note the added tests. |
…tory-contents-only
|
@chrissnyder2337 , thanks for the fixes and tests. |
|
@chrissnyder2337 , after another round of discussions, having a default parameter with a true value, which practically has no sense to keep, we came to this name: |
|
@const-cloudinary I get it, naming things is hard. I have changed the option to |
const-cloudinary
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Will wait for approval from our docs team.
jackieros
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@const-cloudinary Reviewed help texts.
| @option("-t", "--transformation", help="The transformation to apply on all uploads.") | ||
| @option("-f", "--folder", default="", | ||
| help="The Cloudinary folder where you want to upload the assets. " | ||
| "You can specify a whole path, for example folder1/folder2/folder3. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@const-cloudinary - Suggest changing this help text to:
The path where you want to upload the assets. The path you specify will be pre-pended to the public IDs of the uploaded assets. You can specify a whole path, for example path1/path2/path3.
|
@const-cloudinary @jackieros Let me know which, if not all, of the documentation suggestions to include in this PR. |
Co-authored-by: Jackie Rosenzveig <jackie@cloudinary.com>
Co-authored-by: Jackie Rosenzveig <jackie@cloudinary.com>
|
@chrissnyder2337 Thank you very much for your contribution! |
|
Fixes #64 |
Brief Summary of Changes
Add the ability to upload the contents of a local directory without requiring that the parent directory (the
local_folder) be created in Cloudinary.Without this change, it is impossible to use
cld upload_dirto upload a local directory's contents to Cloudinary without also creating a directory/folder within Cloudinary that also has the same name.This was implemented by introducing new
--exclude-dir-name (-e)command option that allowa the user to decide if the local parent directory should be created in Cloudinary, or just its contents.Example without flag
Upload the local folder,
my_images, and all its contents and sub-folders to the Cloudinary foldermy_images_on_cloudinary, overwriting existing files. This example was pulled from the Cloudinary CLI documentation.cld upload_dir -f my_images_on_cloudinary -o overwrite true my_imagesThis would result in the following folder structure in Cloudinary:
Example using new -e (--exclude-dir-name) flag
Upload the contents of local folder,
my_images, and all sub-folders to the Cloudinary foldermy_images_on_cloudinary, overwriting existing files.cld upload_dir -f my_images_on_cloudinary -e -o overwrite true my_imagesThis would result in the following folder structure in Cloudinary:
What does this PR address?
Are tests included?
Reviewer, please note:
Checklist: