Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support posting images with no caption #36

Open
gaaruru opened this issue Apr 18, 2022 · 2 comments
Open

Support posting images with no caption #36

gaaruru opened this issue Apr 18, 2022 · 2 comments

Comments

@gaaruru
Copy link

gaaruru commented Apr 18, 2022

Using a command in the form tweet.sh tw -i image.png Hello world will successfully post the image and caption, but tweet.sh tw -i image.png causes the script to hang indefinitely for me, when I would expect it to post the image with no caption. It also hangs when sending a space, like " ".

It seems like the problem can be solved by not putting the word status in the params variable in post() if there are no more params to follow status. Images seem to work with or without captions by including the word status in posting_body():

posting_body() {
  if [ "$*" != '' ]; then
    echo -n -e "status $*" | sed -E -e 's/$/\\n/' | paste -s -d '\0' -
  fi
}

and removing the word status from post():

$(posting_body $*)

That way, the word status is not sent if there is no status/caption.
But I'm not a shell expert so I don't know if this snippet would cause other problems.

Thanks!

@piroor
Copy link
Owner

piroor commented Apr 19, 2022

The commit 1672de7 allows you to post images without text, like as:

$ echo '' | ./tweet.sh tw -i ~/photos/1.jpg

Please note that you still need to give a blank text via the STDIN (echo '' | ...), otherwise it will hang up.

@piroor
Copy link
Owner

piroor commented Apr 19, 2022

Update: with more commits 6eceaea , 68ef7f2 , and 92ed1ee, now you can post images without any blank input like:

$ ./tweet.sh tw -i ~/photos/1.jpg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants