From ffb98868a4c6e98521de76179b9cd3d3344aa442 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 21 Feb 2019 12:07:28 -0500 Subject: [PATCH] color and etc --- mw | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/mw b/mw index c6d09ff..8019ea1 100755 --- a/mw +++ b/mw @@ -92,13 +92,14 @@ unmailboxes * userexit() { clear; exit ;} addaccount() { \ - printf "Insert the email address that you want to autoconfigure for mutt/offlineIMAP\\n\\nEmail: " + printf "Insert the \033[31memail address\033[0m that you want to autoconfigure for mutt/offlineIMAP\\n\\nEmail: " read -r fulladdr while ! echo "$fulladdr" | grep "$emailre" >/dev/null; do - printf "That is not a valud email address, please retype the desired email.\\n\\nEmail: " + printf "That is not a valid \033[31memail address\033[0m, please retype the desired email.\\n\\nEmail: " read -r fulladdr done domain="$(echo "$fulladdr" | sed "s/.*@//")" + printf "\\nSearching for \033[32m%s\033[0m in \033[34m\`domains.csv\`\033[0m..." "$domain" serverinfo="$(grep "$domain" "$muttdir/domains.csv")" if [ -z "$serverinfo" ]; then printf "Your email domain is not in mutt-wizard's database yet.\\nmutt-wizard will still autoconfigure everything, but you will have to manually type in your service's IMAP and SMTP server information.\\nYou can usually quickly find this by internet searching for it.\\n" @@ -111,28 +112,30 @@ addaccount() { \ printf "What is your server's SMTP port number? (Usually 587 or 465)\\n" read -r sport printf "\\nGreat! If you want to be helpful, copy the line below and you can add it to the \`domains.csv\` file on Github.\\nThis will make things easier for others who use your email provider.\\n\\n%s,%s,%s,%s,%s\\n\\nAlthough be sure to test to see if these settings work first! ;-)\\n" "$domain" "$imap" "$iport" "$smtp" "$sport" - exit else IFS=, read service imap iport smtp sport </dev/null; do - printf "Try again. Pick a nickname that is one word only including lowercase letters and _ or -.\\nAccount name: " + printf "\033[31mTry again\033[0m. Pick a nickname that is one word only including lowercase letters and _ or -.\\n\tAccount name: " read -r title done - printf "If your account has a special username different from your address, insert it now. Otherwise leave this prompt totally blank.\\nLogin(?): " + printf "If your account has a special username different from your address, insert it now. Otherwise leave this prompt totally blank.\\n\tLogin(?): " read -r login [ -z "$login" ] && login="$fulladdr" if [ "$service" = "gmail.com" ]; then type="Gmail"; ifgoogleline="folderfilter = lambda foldername: foldername not in ['[Gmail]/All Mail']" - printf "Google mail account detected. Remember to check the README to make sure of Google-specific settings you must enable.\\n" + printf "\033[1mGoogle\033[0m mail account detected. Remember to check the README to make sure of Google-specific settings you must enable.\\n" else type="IMAP"; ifgoogleline="remotehost = $imap" fi @@ -150,7 +153,7 @@ EOF } getpass() { \ - printf "Now enter your password for the \"%s\" account. Don't worry, this will be encrypted and only you with your GPG key can view it.\\nPassword: " "$1" + printf "Now enter your password for the \"%s\" account. Don't worry, this will be encrypted and only you with your GPG key can view it.\\n\tPassword: " "$1" stty -echo read -r password stty echo @@ -221,10 +224,11 @@ detectMailboxes() { \ [ -z "$gpgemail" ] && askgpg + main() { \ while : ; do - printf "What would you like mutt-wizard to do? - 1 Add an email account + printf "What would you like \033[32mmutt-wizard\033[0m to do? + \033[31m1 Add an email account\033[0m 2 Autodetect mailboxes 3 Change an account's password 0 Exit