alturnative to twitter/twtxt/mastodon that uses git, i suppose you could also use it as a git feed lol
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
2.3 KiB

#!/bin/sh
halp(){
cat <<EOF
goop - alturnative to twtxt that uses git
you can also use it as a sort of git-feed too lol
init - initilize your goop
kp - run commands on the known-people repo
(t)imeline - view the timeline
(p)ost [msg] - post something
(s)post [msg] - post something and sign it (goop will do
wonky things if your gpg commit signing is not setup)
the (letter) means that there is a one-letter alias to
more easily access the command
any unrecognized option will just be passed to git
EOF
exit
}
timeline(){
git fetch --all
git log --pretty="%Cred%GS%Creset%C(green)%an%Creset <%C(green)%ae%Creset> %C(white)%ar%Creset%Cred% D%Creset%n%w(50,1,1)%B" --remotes
exit
}
init(){
mkdir ~/.goop
cd ~/.goop
git init
mkdir known-people
cd known-people
git init
echo 'you are all set! go find some remotes!'
exit
}
post(){
git commit --allow-empty -m "${*:2}" || git commit --allow-empty
exit
}
spost(){
git commit --allow-empty -m "${*:2}" -S || git commit --allow-empty -S
exit
}
kppull(){
git pull --all
git for-each-ref refs/remotes --format '%(refname)' | tr '\n' ' ' | xargs git merge
exit
}
kpaddr(){
while read inn; do git remote add $inn;done<remotes.txt
exit
}
evo(){
while read inn; do git remote add $inn;done<known-people/people.txt
exit
}
kp(){
[ "$1" = "" ] && echo "looks like nobody is known yet, lets change that! 'goop kp remote add person https://git.example.com/person/goop-known-people' or something and then 'goop kp pull --all' and you should see some people in ~/.goop/known-people/people.txt that you can 'goop remote add person https://git.example.com/person/goop' or something. there should also be a remotes.txt that has more known-people remotes if your current people.txt does not have everyone you want to find" && exit
[ "$1" = "pull" ] && kppull
[ "$1" = "addremotes" ] && kpaddr
git $@
exit
}
[ "$1" = "help" ] && halp || [ "$1" = "" ] && halp
[ "$1" = "init" ] && init
cd ~/.goop/known-people
[ "$1" = "kp" ] && kp ${@:2}
cd ~/.goop
[ "$1" = "timeline" ] && timeline || [ "$1" = "t" ] && timeline
[ "$1" = "post" ] && post $@ || [ "$1" = "p" ] && post $@
[ "$1" = "spost" ] && spost $@ || [ "$1" = "s" ] && spost $@
[ "$1" = "followeveryone" ] && evo
# just pass things to git if not recognised
git $@