diff --git a/README.md b/README.md index a69f0a7..860a87c 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Ideal for quickly sharing screenshots or images in environments like IRC without * Set an optional auto-deletion expiration time (e.g., `5m`, `2h`, `7d`, `0` for none). * Specify a custom filename for the uploaded image on ImgBB. * Optionally output and copy the URL in Markdown format. +* Optionally output and copy the URL in orgmode format. * Copies the resulting URL to the X11 clipboard. * Provides desktop notifications for progress and success/failure (optional). @@ -85,6 +86,7 @@ This script requires a **free API key** from ImgBB: * `-e, --expire DURATION`: Set auto-deletion timeout. DURATION is a number followed by `s`(econds), `m`(inutes), `h`(ours), or `d`(ays) (e.g., `5m`, `2h`, `7d`, `300s`). Range: 60s-180d. Use `0`, `none`, or `never` for no expiration (overrides the default). Default expiration is 2 hours (7200s) if this option is not used. * `-n, --name NAME`: Set a custom filename for the uploaded image on ImgBB. * `--markdown`: Output and copy the URL in Markdown image format: `![](URL)` +* `--org`: Output and copy the URL in Orgmode image format: `[[url][alt text]]` * `-h, --help`: Show the help message and exit. **Examples:** @@ -111,8 +113,3 @@ imgbb -h # Notes - Supports both X11 (using xclip) and Wayland (using wl-clipboard) sessions. It detects the session type using $XDG_SESSION_TYPE. - - -# License - -This project is licensed under the GPL License. See the LICENSE file for details. (Action: You need to add a file named LICENSE to your repository containing the text of the GPL, likely GPLv3). diff --git a/imgbb b/imgbb index 0848e9f..aeee10f 100755 --- a/imgbb +++ b/imgbb @@ -19,6 +19,7 @@ filepath="" expire_seconds="7200" # 2h - Set to "" for no expiry. or use flag -e 0, never or none. custom_name="" markdown_mode="false" +org_mode="false" clipboard="$XDG_SESSION_TYPE" [ ! -e "$config_file" ] || . "$config_file" @@ -35,6 +36,7 @@ print_usage() { echo " '0', 'none', 'never' to override default expiry." echo " -n, --name NAME Set a custom filename for the uploaded image." echo " --markdown Output/copy the URL in Markdown image format." + echo " --org Output/copy the URL in Orgmode image format." echo " -h, --help Show this help message." } @@ -107,6 +109,12 @@ while [[ $# -gt 0 ]]; do ;; --markdown) markdown_mode="true" + org_mode="false" # Sorry org, only one at a time. + shift + ;; + --org) + org_mode="true" + markdown_mode="false" shift ;; -h|--help) @@ -308,6 +316,9 @@ if [ "$markdown_mode" = "true" ]; then # Basic markdown image syntax - assumes filename is not needed for alt text here. output_url="![](${image_url})" echo "Formatting as Markdown." +elif [ "$org_mode" = "true" ]; then + output_url="[[${image_url}][]]" + echo "Formatting as orgmode." fi # Output the URL to terminal and copy to clipboard.