fix alt text, i think
authorIan Kelling <iank@fsf.org>
Thu, 23 Feb 2023 12:20:06 +0000 (07:20 -0500)
committerIan Kelling <iank@fsf.org>
Thu, 23 Feb 2023 12:20:06 +0000 (07:20 -0500)
pdt.sh

diff --git a/pdt.sh b/pdt.sh
index d4952eb0537336507c0cf7b6fb95468fb8f1d4a2..a93932690a973e0ee90fce91129fa61ab9426e30 100644 (file)
--- a/pdt.sh
+++ b/pdt.sh
@@ -114,7 +114,7 @@ toot() {
 # -m IMAGE_FILE = Uploads IMAGE_FILE. if MEDIA_FILE.txt exists, the last line of that file will be used as ALT_TEXT
 #                 unless -a has been used.
 pdt() {
-  local video media twitter_account gs_account mastodon_account video gs_arg alt_text network
+  local video media twitter_account gs_account mastodon_account video gs_arg network
   local do_mastodon do_twitter do_gnusocial
   local -a toot_args
   if [[ $pdttest ]]; then
@@ -156,7 +156,6 @@ pdt() {
         ;;
       -a)
         alt_text="$2"
-        toot_args+=(--description "$alt_text" )
         shift 2
         ;;
       -m)
@@ -190,6 +189,9 @@ pdt() {
     if [[ ! $alt_text && -r $media.txt && -s $media.txt ]]; then
       alt_text=$(tail -n1 $media.txt)
     fi
+    if [[ $alt_text ]]; then
+      toot_args+=(--description "$alt_text" )
+    fi
   fi
   # if we have no argument
   if (( ! $# )); then
@@ -336,7 +338,7 @@ pdt-pip-setup() {
 
 # generally only meant to be called internally from pdt-setup
 pdt-twitter-setup() {
-    # twitter setup
+  # twitter setup
   mkdir -p ~/src/twitter
   cd ~/src/twitter
   python3 -m virtualenv -p python3 venv