|
2 | 2 | from os.path import dirname, join as path_join |
3 | 3 | from pathlib import Path |
4 | 4 |
|
5 | | -from click import command, argument, option, style |
| 5 | +from click import command, argument, option, style, launch |
6 | 6 |
|
7 | 7 | from cloudinary_cli.utils.api_utils import upload_file |
8 | 8 | from cloudinary_cli.utils.file_utils import get_destination_folder, is_hidden_path |
|
21 | 21 | help="Pass optional parameters as interpreted strings.") |
22 | 22 | @option("-t", "--transformation", help="The transformation to apply on all uploads.") |
23 | 23 | @option("-f", "--folder", default="", |
24 | | - help="The Cloudinary folder where you want to upload the assets. " |
25 | | - "You can specify a whole path, for example folder1/folder2/folder3. " |
26 | | - "If your product environment uses fixed folder mode, then any folders that do not exist are automatically created.") |
| 24 | + help="The path where you want to upload the assets. " |
| 25 | + "The path you specify will be pre-pended to the public IDs of the uploaded assets. " |
| 26 | + "You can specify a whole path, for example path1/path2/path3. " |
| 27 | + "If your product environment uses fixed folder mode, then any folders that do not exist are " |
| 28 | + "automatically created.") |
27 | 29 | @option("-p", "--preset", help="The upload preset to use.") |
28 | 30 | @option("-e", "--exclude-dir-name", is_flag=True, default=False, |
29 | | - help="Don't include the selected parent directory name in the public ID path of the uploaded files." |
30 | | - "This ensures that the public ID paths of the uploaded assets will be directly under the specified --(f)older, avoiding an extraneous level in the path." |
31 | | - "When this option is used, the contents of the parent directory are uploaded instead of the parent directory itself and thus the name of the specified parent directory is not included in the pubic ID path of the uploaded assets.") |
| 31 | + help="When this option is used, the contents of the parent directory are uploaded but not the parent " |
| 32 | + "directory itself. Thus, the name of the specified parent directory is not included " |
| 33 | + "in the pubic ID path of the uploaded assets.") |
32 | 34 | @option("-w", "--concurrent_workers", type=int, default=30, help="Specify the number of concurrent network threads.") |
| 35 | +@option("-d", "--doc", is_flag=True, help="Open upload_dir command documentation page.") |
33 | 36 | def upload_dir(directory, glob_pattern, include_hidden, optional_parameter, optional_parameter_parsed, transformation, |
34 | | - folder, preset, concurrent_workers, exclude_dir_name): |
| 37 | + folder, preset, concurrent_workers, exclude_dir_name, doc): |
35 | 38 | items, skipped = {}, {} |
36 | 39 |
|
| 40 | + if doc: |
| 41 | + return launch("https://cloudinary.com/documentation/cloudinary_cli#upload_dir") |
| 42 | + |
37 | 43 | dir_to_upload = Path(path_join(getcwd(), directory)) |
38 | 44 | if not dir_to_upload.exists(): |
39 | 45 | logger.error(f"Directory: {dir_to_upload} does not exist") |
|
0 commit comments