mirror of
https://github.com/jb55/nostril.git
synced 2024-12-25 11:35:51 -05:00
30 lines
420 B
Plaintext
30 lines
420 B
Plaintext
|
#!/usr/bin/env bash
|
||
|
|
||
|
set -e
|
||
|
|
||
|
TMP=$(mktemp)
|
||
|
|
||
|
$EDITOR "$TMP"
|
||
|
|
||
|
if [ ! -f "$TMP" ]; then
|
||
|
printf "could not create temporary file\n" >&2
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
content="$(cat $TMP)"
|
||
|
|
||
|
re="^[[:space:]]*$"
|
||
|
if [[ "$content" =~ $re ]]; then
|
||
|
printf "note empty. aborting.\n" >&2
|
||
|
exit 2
|
||
|
fi
|
||
|
|
||
|
note=$(nostril "$@" --content "$content")
|
||
|
|
||
|
printf "relaying:\n" >&2
|
||
|
printf "$note\n"
|
||
|
<<<"$note" nostr-relay-note
|
||
|
printf "done.\n" >&2
|
||
|
|
||
|
rm -f "$TMP"
|