Browse Source

passwords can be given by commandline

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

+ 1
- 0
README.md View File

@@ -46,6 +46,7 @@ The mutt-wizard is run with the command `mw`. Once everything is setup, you'll u
- `-s` -- SMTP server address
- `-S` -- SMTP server port (otherwise assumed to be 587)
- `-m` -- Maximum number of emails to be kept offline. No maximum is default functionality.
- `-x` -- Account password. You will be prompted for it otherwise.

#### General Settings



+ 11
- 3
bin/mw View File

@@ -122,7 +122,6 @@ bind index gg first-entry
unmailboxes *
"
fi
printf "DONE.\\n"
}

parsedomains(){ serverinfo="$(grep "^${fulladdr#*@}" "$muttshare/domains.csv" 2>/dev/null)"
@@ -156,6 +155,7 @@ delete() { if [ -z "${fulladdr+x}" ]; then
rm -rf "${cachedir:?}/${fulladdr:?}" "$accdir/"[1-9]"-$fulladdr.muttrc"
sed -ibu "/[0-9]-$fulladdr.muttrc/d" "$muttrc" ; rm -f "$muttrc"bu
sed -ibu "/account $fulladdr/,/^\(\s*$\|account\)/d" "$msmtprc"; rm -f "$msmtprc"bu
pass rm -f "$pass_prefix$fulladdr" >/dev/null 2>&1
}

askinfo() { \
@@ -174,9 +174,16 @@ askinfo() { \
[ -z "$realname" ] && echo "Give the name you would like to be identified by on the email account:" &&
read -r realname
login="${login:-$fulladdr}"
getpass
if [ -n "${password+x}" ]; then
createpass
else
getpass
fi
}

createpass() { echo "$password" > "$PASSWORD_STORE_DIR/$pass_prefix$fulladdr"
"$GPG" -qer "$(cat "$PASSWORD_STORE_DIR/.gpg-id")" "$PASSWORD_STORE_DIR/$pass_prefix$fulladdr"
rm -f "$PASSWORD_STORE_DIR/$pass_prefix$fulladdr" ;}

writeinfo() { mkdir -p "$muttdir" "$accdir" "$cachedir/$fulladdr/bodies" "${XDG_CONFIG_HOME:-$HOME/.config}/msmtp" "$maildir/$fulladdr"

@@ -287,7 +294,7 @@ setact() { if [ -n "${action+x}" ] && [ "$action" != "$1" ]; then

trap 'echo -e "\033[0m\n"; exit' INT ABRT

while getopts "fplhdYD:y:i:I:s:S:u:a:n:" o; do case "${o}" in
while getopts "fplhdYD:y:i:I:s:S:u:a:n:x:" o; do case "${o}" in
l) setact list || exit 1 ;;
d) setact delete || exit 1 ;;
D) setact delete || exit 1 ; fulladdr="$OPTARG" ;;
@@ -303,6 +310,7 @@ while getopts "fplhdYD:y:i:I:s:S:u:a:n:" o; do case "${o}" in
m) setact add || exit 1 ; maxmes="$OPTARG" ;;
o) setact add || exit 1 ; online=True ;;
f) setact add || exit 1 ; force=True ;;
x) setact add || exit 1 ; password="$OPTARG" ;;
p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work."
proton=True
imap="127.0.0.1"


+ 3
- 0
mw.1 View File

@@ -58,6 +58,9 @@ SMTP server address
.TP
.B -S
SMTP server port (assumed to be 587 if not specified)
.TP
.B -x
Account password. You will be prompted for the password interactively if this option is not given.
.SH OTHER OPTIONS
.TP
.B -f


Loading…
Cancel
Save