commit 19c4fdb2c5f9ee45547d66597f35a0c5fd7af291
parent 5f46a1a3930d574f0c1ec9de8d353fd5ed78f95a
Author: Luke Smith <luke@lukesmith.xyz>
Date: Thu, 21 Feb 2019 11:39:25 -0500
loop
Diffstat:
M | mw | | | 44 | +++++++++++++++++++------------------------- |
1 file changed, 19 insertions(+), 25 deletions(-)
diff --git a/mw b/mw
@@ -110,7 +110,7 @@ addaccount() { \
read -r smtp
printf "What is your server's SMTP port number? (Usually 587 or 465)\\n"
read -r sport
- printf "Great. If you want to be helpful, copy the line below and you can add it to the \`domains.csv\` file on Github. This 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"
+ 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 <<EOF
@@ -221,29 +221,23 @@ detectMailboxes() { \
[ -z "$gpgemail" ] && askgpg
-while : ;
- do
-choice=$(dialog --title "Luke's mutt/offlineIMAP wizard" --nocancel \
- --menu "What would you like to do?" 15 50 8 \
- 0 "Add email account (Begin installtion)" \
- 1 "Autodetect mailboxes (Finalize installation)" \
- 2 "Enable/disable autosync." \
- 3 "Change an account's password" \
- 4 "Remove an account" \
- 5 "Remove all accounts" \
- 6 "Change your GPG email" \
- 7 "Exit this wizard." \
- 3>&1 1>&2 2>&3 3>&1 )
-
-case $choice in
-0) addaccount ;;
-1) detectWarning && chooseDetect;;
-3) inventory && for i in $userchoices; do getpass "$i" ; done;;
-4) inventory && for i in $userchoices; do removeAccount "$i" ; done;;
-5) (dialog --defaultno --title "Wipe all custom neomutt/offlineIMAP settings?" --yesno "Would you like to wipe all of the mutt/offlineIMAP settings generated by the system?" 6 60 && wipe) ;;
-6) askgpg ;;
-7) clear && break ;;
-*) echo "Error. Are you sure you have dialog installed?" >&2; exit 2
-esac
+main() { \
+ while : ; do
+ printf "What would you like mutt-wizard to do?
+ 1 Add an email account
+ 2 Autodetect mailboxes
+ 3 Change an account's password
+ 0 Exit
+Input a number to continue or press ctrl-c.\\n"
+ read -r choice
+ case "$choice" in
+ 1) addaccount ;;
+ 0) break ;;
+ *) printf "Invalid input.\\n"
+ esac
done
+}
+
+main
+
rm -rf "$tmpdir"