#!/usr/bin/env bash set -euo pipefail # Usage: forward.sh BACKEND=${1:-} ID=${2:-} DEST=${3:-} if [[ -z "$BACKEND" || -z "$ID" || -z "$DEST" ]]; then echo "Usage: $0 " >&2 exit 2 fi case "$BACKEND" in outlook) node ./forward_outlook.cjs "$ID" "$DEST" || { echo "Outlook forward failed" >&2; exit 1; } ;; gmail) node ./forward_gmail.cjs "$ID" "$DEST" || { echo "Gmail forward failed" >&2; exit 1; } ;; himalaya) echo "Himalaya: use himalaya message forward (not automated)" >&2 exit 2 ;; *) echo "Unknown backend: $BACKEND" >&2 exit 2 ;; esac