💾 Archived View for m15o.midnight.pub › midnight-sh.gmi captured on 2024-05-12 at 15:18:27. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2021-12-03)

-=-=-=-=-=-=-

#!/bin/bash

host=https://midnight.pub

if [ $# -eq 0 ]
then
    curl -F title="$(head -1 /dev/stdin)"\
	 -F content="$(tail -n +2 /dev/stdin)"\
	 -b midn="$(cat ~/.config/.midnight)"\
	 $host/posts/save
fi

while getopts "r:t:" OPTION; do
    case $OPTION in
	r)
	    curl -F reply="$(cat /dev/stdin)"\
		 -b midn="$(cat ~/.config/.midnight)"\
		 $host/posts/$OPTARG/reply
            ;;
	t)
	    curl -F reply="$(cat /dev/stdin)"\
		 -b midn="$(cat ~/.config/.midnight)"\
		 $host/replies/$OPTARG/save
            ;;
	*)
            echo "Incorrect options provided"
            exit 1
            ;;
    esac
done