浏览代码

remove script now visual

tags/v3.1
Luke 6 年前
父节点
当前提交
7a8ded1b6c
共有 3 个文件被更改,包括 28 次插入16 次删除
  1. 二进制
      credentials/imappwd.pyc
  2. +28
    -8
      removeaccount.sh
  3. +0
    -8
      stat.sh

二进制
credentials/imappwd.pyc 查看文件


+ 28
- 8
removeaccount.sh 查看文件

@@ -6,15 +6,35 @@ muttdir="$HOME/.config/mutt/"

# 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 "
/Account $title]/,/Account/{//!d}
/Account $title]/d
s/ $title\(,\|$\)//g
s/=$title\(,\|$\)/=/g
/Account $1]/,/Account/{//!d}
/Account $1]/d
s/ $1\(,\|$\)//g
s/=$1\(,\|$\)/=/g
s/,$//g
" ~/.offlineimaprc
rm "$muttdir"accounts/$title.muttrc
echo $title deleted. ;}
#removeAccount $title
rm "$muttdir"accounts/$1.muttrc
echo $1 deleted. ;}

#/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




+ 0
- 8
stat.sh 查看文件

@@ -1,8 +0,0 @@
#!/bin/sh

# Gets all accounts used by offlineimaps.

cat ~/.offlineimaprc | grep "^accounts =" | sed -e 's/accounts =\( \)//g;s/\(,\) /\n/g;'
# Another option
# Get current accounts
#accountsline=$(cat ~/.offlineimaprc | grep ^accou | sed 's/,//g')

正在加载...
取消
保存