💾 Archived View for midnight.pub › posts › 370 captured on 2022-04-29 at 13:27:19. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
This is just a test. I haven't had much free time lately, but I wanted to try this out. Smudge says hi.
I did have to edit my copy to use getopt instead of getopts since I'm on OpenBSD and not GNU/Linux, but I suppose a symlink would have served equally well. I also had to change the shebang because bash doesn't live in /bin on OpenBSD.
Here's my version.
#!/usr/bin/env 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 getopt "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
Unfortunately, while I got the script to run it still doesn't work for me. Here are my results.
/home/starbreaker/bin/midnight: line 8: -F: command not found /home/starbreaker/bin/midnight: line 10: https://midnight.pub/posts/save: No such file or directory /home/starbreaker/bin/midnight: line 9: -b: command not found /home/starbreaker/bin/midnight: line 30: syntax error near unexpected token `done' /home/starbreaker/bin/midnight: line 30: `done' kether:/home/starbreaker/internet/midnight.pub$ curl: no URL specified! curl: try 'curl --help' or 'curl --manual' for more information
I guess I'll stick with posting from the browser for now since it wouldn't be fair to expect ~m150 to set up an OpenBSD virtual machine just to make sure midnight.sh works for me.
Besides, "cat testing-midnight-sh.gmi | xclip" works well enough for me.
You're displaying " for " , is that there in the version on your system too? That might explain why the curl line is apparently not interpreted as one continuing line.