From 7a8ded1b6c6f9a018785e5cda90c7508ad50d8b3 Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 10 Feb 2018 10:12:10 -0700 Subject: [PATCH] remove script now visual --- credentials/imappwd.pyc | Bin 0 -> 724 bytes removeaccount.sh | 36 ++++++++++++++++++++++++++++-------- stat.sh | 8 -------- 3 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 credentials/imappwd.pyc delete mode 100755 stat.sh diff --git a/credentials/imappwd.pyc b/credentials/imappwd.pyc new file mode 100644 index 0000000000000000000000000000000000000000..194e73cc260cf1694bd1006d38f6c158a54de8e9 GIT binary patch literal 724 zcmbVKJ8#rL5dPM_M|4~eiWEYP6v@rm1qBU4ND*xm`3lfAXwSRxUY7Cj4#ri_f)J?0(Bchb%LeD;8>4d7$D(0rrqChY`$&65a-Qd0@;y z8XLx8gc=x(?D5cCC>(4yKIyzy*YkJN4 zl9D*<+S@Wun!)=d>#eb^FLh1HCB?bRnFPR=p0Qo62C^%ia|zAI`0G&GCx5GbR*-CM zWq2T91oD#Th{*s>`@#$QR+DXYW5;aKv9sVT4O`cDnI-Z|4zt2$yD#0~9aEdid*7GN zpRsqP>)M)|WAVqn@A^o1j_q`o`Bc!3QJ+)90Y*hJdx-!h^{})59=>d}b9W|o4by*6<4ZRBk^#W%ZZa Ye-k|6Ht(9w47GhPe-}yfrCKt<-!l@Li2wiq literal 0 HcmV?d00001 diff --git a/removeaccount.sh b/removeaccount.sh index 43bf3b9..cfae388 100755 --- a/removeaccount.sh +++ b/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 + + + diff --git a/stat.sh b/stat.sh deleted file mode 100755 index fa0143f..0000000 --- a/stat.sh +++ /dev/null @@ -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')