summaryrefslogtreecommitdiff
path: root/mutt-wizard.sh
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2018-02-26 18:12:02 -0500
committerGitHub <noreply@github.com>2018-02-26 18:12:02 -0500
commit2c05667deefc19b35ace65dbab14eee7e9ba9cbb (patch)
tree353a4e8f6d6ff3431cf4a9d68b5cfd462ae96b79 /mutt-wizard.sh
parent8545f779bf07aaee3f7fa034813796319227b6d3 (diff)
parented1a729aaf065877a5d042d222d8063600a81049 (diff)
Merge pull request #21 from drmtmych/master
Add account name to sidebar head.
Diffstat (limited to 'mutt-wizard.sh')
-rwxr-xr-xmutt-wizard.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/mutt-wizard.sh b/mutt-wizard.sh
index d5092ee..b48343d 100755
--- a/mutt-wizard.sh
+++ b/mutt-wizard.sh
@@ -36,9 +36,20 @@ formatShortcut() { \
echo "macro index,pager g$1 \"<change-folder>$data<enter>\" \"Go to $2.\"" >> "$muttdir"accounts/$3.muttrc
done ;}
+gen_delim() { \
+ delim="="
+ for i in `seq $(( $1 - 1 ))`
+ do
+ delim="$delim-"
+ done
+ echo $delim ;}
+
detectMailboxes() { \
find ~/.mail/$1 -maxdepth 1 -mindepth 1 -type d | sed -e "s/.*\///g;s/^/=/g" > /tmp/$1_boxes
+ sidebar_width=$(sed -n -e '/^set sidebar_width/p' "$muttdir"/muttrc | awk -F'=' '{print $2}')
+ delim=$(gen_delim $sidebar_width)
oneline=$(cat /tmp/$1_boxes | tr "\n" " ")
+ oneline="=$1 $delim $oneline"
sed -i "/^mailboxes\|^set spoolfile\|^set record\|^set postponed/d" "$muttdir"accounts/$1.muttrc
echo mailboxes $oneline >> "$muttdir"accounts/$1.muttrc
sed -i "/^macro index,pager g/d" "$muttdir"accounts/$1.muttrc