Having a default account setter is handy, instead of having to mod the creds file constantly.
This commit is contained in:
parent
261f125761
commit
b3185b2d25
4
PKGBUILD
4
PKGBUILD
|
@ -2,7 +2,7 @@
|
||||||
#Well, it seems to work now.
|
#Well, it seems to work now.
|
||||||
|
|
||||||
pkgname=clemmy
|
pkgname=clemmy
|
||||||
pkgver=0.1.4
|
pkgver=0.1.6
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc='A pure bash client for lemmy, with multiaccount support.'
|
pkgdesc='A pure bash client for lemmy, with multiaccount support.'
|
||||||
arch=('any')
|
arch=('any')
|
||||||
|
@ -15,7 +15,7 @@ sha256sums=('SKIP') #Don't know how to use this on a repo.
|
||||||
package() {
|
package() {
|
||||||
cd ${pkgname}
|
cd ${pkgname}
|
||||||
install -d ${pkgdir}/usr/bin ${pkgdir}/opt/clemmy
|
install -d ${pkgdir}/usr/bin ${pkgdir}/opt/clemmy
|
||||||
rm PKGBUILD README.txt
|
rm README.txt
|
||||||
cp -r . ${pkgdir}/opt/clemmy
|
cp -r . ${pkgdir}/opt/clemmy
|
||||||
ln -s /opt/clemmy/clemmy.sh ${pkgdir}/usr/bin/clemmy
|
ln -s /opt/clemmy/clemmy.sh ${pkgdir}/usr/bin/clemmy
|
||||||
chmod +x ${pkgdir}/opt/clemmy/clemmy.sh
|
chmod +x ${pkgdir}/opt/clemmy/clemmy.sh
|
||||||
|
|
10
creds.sh
10
creds.sh
|
@ -11,6 +11,8 @@ if [ ! -f ~/.config/clemmy/accounts.csv ]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
touch ~/.config/clemmy/default_account
|
||||||
|
|
||||||
accsr=$(cat ~/.config/clemmy/accounts.csv)
|
accsr=$(cat ~/.config/clemmy/accounts.csv)
|
||||||
i=0
|
i=0
|
||||||
for line in ${accsr[*]}; do
|
for line in ${accsr[*]}; do
|
||||||
|
@ -18,9 +20,7 @@ for line in ${accsr[*]}; do
|
||||||
i=$((i+1))
|
i=$((i+1))
|
||||||
done
|
done
|
||||||
|
|
||||||
select_account()
|
select_account(){ IFS=, read INSTANCE TOKE INSEC <<< "${accs[$1]}"; }
|
||||||
{
|
defaultacc(){ echo -n $1 > ~/.config/clemmy/default_account; }
|
||||||
IFS=, read INSTANCE TOKE INSEC <<< "${accs[$1]}"
|
|
||||||
}
|
|
||||||
|
|
||||||
select_account 0
|
select_account $(cat ~/.config/clemmy/default_account)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user