nostril

A C cli tool for creating nostr events
git clone git://jb55.com/nostril
Log | Files | Refs | Submodules | LICENSE

nostr-post (420B)


      1 #!/usr/bin/env bash
      2 
      3 set -e
      4 
      5 TMP=$(mktemp)
      6 
      7 $EDITOR "$TMP"
      8 
      9 if [ ! -f "$TMP" ]; then
     10 	printf "could not create temporary file\n" >&2
     11 	exit 1
     12 fi
     13 
     14 content="$(cat $TMP)"
     15 
     16 re="^[[:space:]]*$" 
     17 if [[ "$content" =~ $re ]]; then
     18 	printf "note empty. aborting.\n" >&2
     19 	exit 2
     20 fi
     21 
     22 note=$(nostril "$@" --content "$content")
     23 
     24 printf "relaying:\n" >&2
     25 printf "$note\n"
     26 <<<"$note" nostr-relay-note
     27 printf "done.\n" >&2
     28 
     29 rm -f "$TMP"