From c8af76f5bff29897646bc43c83af70cbb26c3f06 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 19 Apr 2019 20:28:31 -0400 Subject: [PATCH] unimportant tweaks --- mw | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/mw b/mw index a4afceb..b96ca37 100755 --- a/mw +++ b/mw @@ -177,8 +177,7 @@ formatShortcut() { \ echo "macro index,pager C$1 \"$data\" \"Copy mail to $2.\" # autogenerated"; } >> "$muttdir/accounts/$3.muttrc" done ;} -trysync() { \ - ! ping -q -c 1 1.1.1.1 > /dev/null && printf "No internet connection detected.\\nTry rerunning \`mbsync %s\` manually when connection is established, then select the option to detect mailboxes and finalize installation.\\n" "$title" && return 1 +trysync() { ! ping -q -c 1 1.1.1.1 > /dev/null && printf "No internet connection detected.\\nTry rerunning \`mbsync %s\` manually when connection is established, then select the option to detect mailboxes and finalize installation.\\n" "$title" && return 1 printf "\033[32mYou must have an internet connection to continue.\033[0m\\nmutt-wizard will run mbsync briefly to (1) ensure that login details are functional and (2) allow mbsync to tell us what mailboxes your email account has.\\nAfter around 15 seconds, mutt-wizard will kill the process and continue.\\nYou can run mbsync manually to finish the mail sync later.\\n" cont mkdir -p "$maildir/$title" @@ -224,7 +223,6 @@ confirm() { printf "Are you \033[31;1mreally\033[0m sure you want to %s?\\n\t" " printf "Are you really, really sure you want to %s?\\n\t" "$@" && read -r input && ! echo "$input" | grep -i "y\(es\)*" >/dev/null && printf "That doesn't seem like a yes to me.\\n\\n" && return 1 return 0 ;} - pick() { numbered="$(ls $accdir/*muttrc | sed "s/.*\///;s/\..*//" | nl)" [ "$(echo "$numbered" | wc -w)" = 0 ] && printf "No accounts to choose from.\\n" && return 1 printf "Select an accounts to %s:\\n" "$1" @@ -241,7 +239,6 @@ delete() { sed -i "/IMAPStore $title-remote$/,/# End profile/d" "$mbsyncrc" rm -rf "${accdir:?}/${title:?}" "$accdir/$title.muttrc" sed -i "/$title.muttrc/d" "$muttdir/personal.muttrc" sed -i "/account $title/,/^\(\s*$\|account\)/d" "$HOME/.config/msmtp/config" - #confirm "delete the local mail repository as well?" && rm -rf "${maildir:?}/${title:?}" } choosecron() { ! pgrep crond >/dev/null && echo "No cron manager running. Install/enable one and then select this option again." && return 1 @@ -263,16 +260,14 @@ choosecron() { ! pgrep crond >/dev/null && echo "No cron manager running. Instal done (crontab -l; echo "*/$minnum * * * * export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus; export DISPLAY=:0; . \$HOME/.profile; $muttdir/bin/mailsync") | crontab - && echo "Cronjob added. Mail will sync every $minnum minutes. Be sure you have your cron manager running." - fi -} + fi ;} cont() { printf "Press Enter to continue.\\n" stty -echo read -r null stty echo ; } -addtype() { \ - ! command -v mbsync >/dev/null && printf "You must have the \`mbsync\` command to add an account.\\nIt syncs mail and detects remote mailboxes.\\nYou can typically get it by installing \`isync\`.\\n" && return 1 +addtype() { ! command -v mbsync >/dev/null && printf "You must have the \`mbsync\` command to add an account.\\nIt syncs mail and detects remote mailboxes.\\nYou can typically get it by installing \`isync\`.\\n" && return 1 while : ; do echo "Do you want to keep your mail for this account offline with mbsync? [yes/no]" read -r offnot @@ -282,11 +277,9 @@ addtype() { \ *) echo "I don't know what you mean. Try again or press ctrl-c to quit." ;; esac done - addaccount -} + addaccount ;} -main() { \ - while : ; do +main() { while : ; do printf "Welcome to:\\n\033[34m" cat << "EOF" _ __ ___ _ _| |_| |_ __ _(_)______ _ _ __ __| | @@ -318,8 +311,7 @@ Input a number to continue or press ctrl-c.\\n" *) printf "Invalid input.\\n" esac cont -done -} +done ;} main rm -rf "$tmpdir"