remove script now visual
This commit is contained in:
parent
becd87feae
commit
7a8ded1b6c
BIN
credentials/imappwd.pyc
Normal file
BIN
credentials/imappwd.pyc
Normal file
Binary file not shown.
@ -6,15 +6,35 @@ muttdir="$HOME/.config/mutt/"
|
|||||||
|
|
||||||
# Feed the script the title of the account.
|
# Feed the script the title of the account.
|
||||||
|
|
||||||
title=$1
|
cat ~/.offlineimaprc | grep "^accounts =" | sed -e 's/accounts =\( \)//g;s/\(,\) /\n/g;' | nl --number-format=ln > /tmp/numbered
|
||||||
|
|
||||||
removeAccount() { sed -ie "
|
removeAccount() { sed -ie "
|
||||||
/Account $title]/,/Account/{//!d}
|
/Account $1]/,/Account/{//!d}
|
||||||
/Account $title]/d
|
/Account $1]/d
|
||||||
s/ $title\(,\|$\)//g
|
s/ $1\(,\|$\)//g
|
||||||
s/=$title\(,\|$\)/=/g
|
s/=$1\(,\|$\)/=/g
|
||||||
s/,$//g
|
s/,$//g
|
||||||
" ~/.offlineimaprc
|
" ~/.offlineimaprc
|
||||||
rm "$muttdir"accounts/$title.muttrc
|
rm "$muttdir"accounts/$1.muttrc
|
||||||
echo $title deleted. ;}
|
echo $1 deleted. ;}
|
||||||
#removeAccount $title
|
|
||||||
|
#/tmp/numbered
|
||||||
|
|
||||||
|
accounts=()
|
||||||
|
while read n s ; do
|
||||||
|
accounts+=($n "$s" off)
|
||||||
|
done < /tmp/numbered
|
||||||
|
|
||||||
|
choices=$(dialog --separate-output --checklist "Choose an email account to remove." 22 76 16 "${accounts[@]}" 2>&1 >/dev/tty)
|
||||||
|
clear
|
||||||
|
|
||||||
|
if [ -z "$choices" ];
|
||||||
|
then
|
||||||
|
echo no selection
|
||||||
|
else
|
||||||
|
todelet=$(IFS="|"; keys="${choices[*]}"; keys="${keys//|/\\|}"; grep -w "${keys}" /tmp/numbered | awk '{print $2}')
|
||||||
|
for i in $todelet; do removeAccount $i; done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user