trunk
vilmibm 2024-05-06 01:53:48 +00:00
parent 65c9f89f75
commit 5082290d15
1 changed files with 67 additions and 0 deletions

67
scripts/tma 100755
View File

@ -0,0 +1,67 @@
#!/bin/bash
set -e
signups="/town/var/signups/signups.db"
invites="/town/var/invites/invites.db"
users="/town/var/town.db"
bold=$(tput bold)
plain=$(tput sgr0)
which="${1}"
header() {
echo $bold
echo $1
echo $plain
}
case $which in
user)
username="${2}"
if [ "$username" == "" ]; then
echo "gimme a username"
exit
fi
header "i looked in $users and found:"
sqlite3 $users "select * from users where username='$username'"
header "their emails are:"
sqlite3 $users "select * from emails where userid in (select id from users where username='$username')"
header "i looked in $invites and found:"
sqlite3 $users "select address from emails where userid in (select id from users where username='$username')" | xargs printf "select * from invites where email='%s'" | sqlite3 $invites
header "i looked in $signups and found:"
sqlite3 $users "select address from emails where userid in (select id from users where username='$username')" | xargs printf "select * from signups where email like '%%%s%%'" | sqlite3 $signups
;;
email)
email="${2}"
if [ "$email" == "" ]; then
echo "gimme an email"
exit
fi
header "i looked in $signups and found:"
sqlite3 $signups "select * from signups where email like '%$email%'";
header "i looked in $invites and found:"
sqlite3 $invites "select * from invites where email='$email'"
header "i looked in $users and found:"
sqlite3 $users "select * from users where id in (select userid from emails where address='$email')"
;;
*)
echo "what do you want to know about?"
echo "i can tell you about: user, email"
exit 1
;;
esac