summaryrefslogtreecommitdiff
path: root/bin/mw
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2019-04-26 11:04:51 -0400
committerLuke Smith <luke@lukesmith.xyz>2019-04-26 11:04:51 -0400
commite4e3b5162467de6e4cba03f1f4414203c359a0e8 (patch)
tree1ab9f4177e24b75da9f0b5342adf9d5e00789b3e /bin/mw
parent42223132cc3e72b69f8bdde4d3f48a61a5358c15 (diff)
generated notmuch config if not existing
Diffstat (limited to 'bin/mw')
-rwxr-xr-xbin/mw20
1 files changed, 20 insertions, 0 deletions
diff --git a/bin/mw b/bin/mw
index c2830fa..f176098 100755
--- a/bin/mw
+++ b/bin/mw
@@ -164,6 +164,7 @@ EOF
echo "$msmtp_profile" >> "$HOME/.config/msmtp/config"
echo "$mutt_profile" > "$accdir/$idnum-$title.muttrc"
echo "$mbsync_profile" >> "$mbsyncrc"
+ notmuchauto
[ ! -f "$muttrc" ] && echo "# vim: filetype=neomuttrc" > "$muttrc" && echo "muttrc created."
! grep "^source.*mutt-wizard.muttrc" "$muttrc" >/dev/null && echo "source $mwconfig # mw-autogenerated" >> "$muttrc"
! grep "^source.*.muttrc" "$muttrc" | grep -v "$mwconfig" >/dev/null && echo "source $accdir/$idnum-$title.muttrc # mw-autogenerated" >> "$muttrc"
@@ -268,6 +269,25 @@ purge() { confirm "delete all account data" || exit
sed -i "/\# mw-autogenerated/d" "$muttrc"
}
+notmuchauto() { \
+ [ -z "$NOTMUCH_CONFIG" ] && NOTMUCH_CONFIG="$HOME/.notmuch-config"
+ [ -f "$NOTMUCH_CONFIG" ] && return 0
+ nmbasic="[database]
+path=$maildir
+[user]
+name=$realname
+primary_email=$fulladdr
+[new]
+tags=unread;inbox;
+ignore=
+[search]
+exclude_tags=deleted;spam;
+[maildir]
+synchronize_flags=true
+[crypto]
+gpg_path=gpg"
+ echo "$nmbasic" > "$NOTMUCH_CONFIG" ;}
+
case "$1" in
ls) list ;;
add) asktype && askinfo && tryconnect && finalize || delete ;;