Browse Source

dude more stuff

tags/v3.1
Luke Smith 5 years ago
parent
commit
4828988474
No known key found for this signature in database GPG Key ID: 4C50B54A911F6252
2 changed files with 34 additions and 11 deletions
  1. +10
    -5
      README.md
  2. +24
    -6
      bin/mw

+ 10
- 5
README.md View File

@@ -21,12 +21,9 @@ Specifically, this wizard:
```
git clone https://github.com/LukeSmithxyz/mutt-wizard ~/.config/mutt
cd ~/.config/mutt
./mw # Run the mutt-wizard
sudo make install
```

Yes you have to put the whole repo in the mutt directory (`~/.config/mutt/`).
Just backup or delete any previous mutt configs (or msmtp or mbsync configs if you have them; if you don't know, you don't have them).

Install these required programs:

- `neomutt` - the email client.
@@ -43,6 +40,15 @@ You might also want some good optional stuff:
- `abook` - a terminal-based address book. Pressing tab while typing an address to send mail to will suggest contacts that are in your abook.
- A cron manager - if you want to enable the auto-sync feature.

## Running mutt-wizard (`mw`)

- `mw add` -- add a new email account
- `mw ls` -- list existing accounts
- `mw pass` -- revise an account's password
- `mw delete` -- deleted an added account
- `mw purge` -- delete all accounts and settings
- `mw cron` -- toggle/configure a cronjob to sync mail

## User interface

To give you an example of the interface, here's an idea:
@@ -96,4 +102,3 @@ mutt-wizard is free/libre software, licensed under the GPLv3.
- The `muttrc` file is for universal settings.
- `personal.muttrc`, called by the `muttrc`, is the place where user-specific settings are set, and the wizard automatically adds the macros for switching between accounts here. If you want to contribute to mutt-wizard, you should put your universal personal settings here and have git ignore it. For example, I put my gpg settings here and personal aliases here.
- Accounts are generated in `accounts/`. If I create an account named `luke`, for example, `accounts/luke.muttrc` will hold that account's unique settings and `accounts/luke/` will hold headers and cache files.
- `bin/` holds the `mailsync` script and other scripts and tools the wizard uses. I make a link with `ln` to this `mailsync` file in my `$PATH` so I can run it from wherever.

+ 24
- 6
bin/mw View File

@@ -213,8 +213,11 @@ confirm() { printf "Do you want to to %s? [y/N]\\n\t" "$@" && read -r input && !
printf "Are you really, really sure you want to %s?\\n\t" "$@" && read -r input && ! echo "$input" | grep -i "^y$\|^yes$" >/dev/null && printf "That doesn't seem like a yes to me.\\n\\n" && return 1
return 0 ;}

pick() { numbered="$(find "$accdir" -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | nl)"
[ "$(echo "$numbered" | wc -w)" = 0 ] && printf "No accounts to choose from.\\n" && return 1
list() { numbered="$(find "$accdir" -mindepth 1 -maxdepth 1 -type d -printf "%f\n" 2>/dev/null | nl)"
[ "$(echo "$numbered" | wc -w)" = 0 ] && printf "No configured accounts.\\n" && return 1
}

pick() { list
printf "Select an accounts to %s:\\n" "$1"
echo "$numbered"
printf "\033[36m\t"
@@ -263,19 +266,34 @@ asktype() { while : ; do

init() { \
echo "Initializing a mutt-wizard configuration..."
[ -f "$muttdir/muttrc" ] && echo "There is already a preexisting config." && return 1
[ -f "$muttdir/muttrc" ] && echo "There is already a preexisting config. Purge the previous to reinit." && return 1
mkdir -p "$muttdir" "$accdir"
cp -v "$muttshare/mailcap" "$muttdir"
cp -v "$muttshare/muttrc" "$muttdir"
}


case "$1" in
init) init ;;
new) asktype && askinfo && tryconnect && finalize ;;
passedit) pick "change the password of" && confirm "change \`$title\`'s password" && getpass ;;
ls) list ;;
add) asktype && askinfo && tryconnect && finalize ;;
pass) pick "change the password of" && getpass ;;
delete) pick delete && confirm "delete the \`$title\` profile" && delete ;;
purge) confirm "delete all account data" && rm -rf "$mbsyncrc" "$accdir" "$muttdir/personal.muttrc" && echo "All configs and account settings have been purged." ;;
cron) choosecron ;;
*) printf "Invalid input.\\n"
*) cat << EOF
mw: mutt-wizard, auto-configure email accounts for mutt
and

Allowed options:
init Run once and first to copy required files
add Add and autoconfigure an email address (9 max.)
ls List configured accounts
delete Pick an account to delete
purge Delete all accounts and settings
cron Enable or disable an autosync via cronjob
all else Print this message
EOF
esac

rm -rf "$tmpdir"

Loading…
Cancel
Save