main
¶
Main logic for the images-upload-cli package.
upload_images
async
¶
upload_images(upload_func: Callable[[AsyncClient, bytes], Awaitable[str]], images: tuple[Path], thumbnail: bool) -> Sequence[tuple[str, str] | tuple[str, None]]
Upload images using the specified upload function and optionally generate thumbnails.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
upload_func |
Callable[[AsyncClient, bytes], Awaitable[str]]
|
The function used to upload the images. |
required |
images |
tuple[Path]
|
The paths of the images to be uploaded. |
required |
thumbnail |
bool
|
Indicates whether to generate thumbnails for the images. |
required |
Returns:
Type | Description |
---|---|
Sequence[tuple[str, str] | tuple[str, None]]
|
The links to the uploaded images and their corresponding thumbnails. |
Sequence[tuple[str, str] | tuple[str, None]]
|
The thumbnail link will be |
Source code in src/images_upload_cli/main.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
format_link
¶
Format the image links based on the specified format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
links |
Sequence[tuple[str, str] | tuple[str, None]]
|
The image links and their corresponding thumbnails. |
required |
fmt |
str
|
The format to use for formatting the links. Valid options are "plain", "bbcode", "html", and "markdown". |
required |
Returns:
Type | Description |
---|---|
str
|
The formatted image links as a string. |
Source code in src/images_upload_cli/main.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|