step 1 of ~20 for git-ssb. please repost git-nostr is important and needs funding.
#!/bin/bash
usage()
{
echo "
Usage: git nostr create
ex: git nostr create nostr ws://192.168.1.164:8080
Create a new git-nostr repo and add it as a git remote
Options:
--private (not implemented) Make repo private
--recps
--secretkey nostr secret key
--relay nostr relay url
"
exit 2
}
if [ $# -lt 1 ]
then
usage
exit 1
fi
PRIVATE=0
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h | --help)
usage
;;
--private)
PRIVATE=true
git config nostr.private $PRIVATE
shift
;;
--recps)
RECIPIENTS="$2"
git config nostr.recps $RECIPIENTS
shift
shift
;;
--secretkey)
SECRETKEY="$2"
shift
shift
;;
*)
if [ -z "$REMOTENAME" ]; then
REMOTENAME="$1"
else
NOSTRRELAY="$1"
fi
shift
;;
esac
done
if ["$SECRETKEY" -eq ""]; then
SECRETKEY=`git config --get nostr.secretkey`
fi
if ["$SECRETKEY" -eq ""]; then
SECRETKEY=`noscl key-gen|grep private|awk '{print$3}'`
git config nostr.secretkey $SECRETKEY
fi
git remote add $REMOTENAME $NOSTRRELAY
nostril --envelope --sec "$SECRETKEY" --kind 17 --tag e "git-repo" --content "git-nostr" | websocat ws://192.168.1.164:8080
echo "created nostr public key: "`nostril --sec $SECRETKEY | jq .pubkey|sed 's/\"//g'`