clemmy/creds.sh

27 lines
575 B
Bash

if [ ! -f ~/.config/clemmy/accounts.csv ]; then
mkdir -p ~/.config/clemmy
touch ~/.config/clemmy/accounts.csv
echo "Do you already have an account? y/n"
read choice
if [ $choice == n ]; then
register
else
login
fi
exit
fi
touch ~/.config/clemmy/default_account
accsr=$(cat ~/.config/clemmy/accounts.csv)
i=0
for line in ${accsr[*]}; do
accs[$i]="$line"
i=$((i+1))
done
select_account(){ IFS=, read INSTANCE TOKE INSEC <<< "${accs[$1]}"; }
defaultacc(){ echo -n $1 > ~/.config/clemmy/default_account; }
select_account $(cat ~/.config/clemmy/default_account)