Browse Source

passwords can be given by commandline

tags/v3.1
Luke Smith 4 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 address
- `-S` -- SMTP server port (otherwise assumed to be 587) - `-S` -- SMTP server port (otherwise assumed to be 587)
- `-m` -- Maximum number of emails to be kept offline. No maximum is default functionality. - `-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 #### General Settings




+ 11
- 3
bin/mw View File

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


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


askinfo() { \ askinfo() { \
@@ -174,9 +174,16 @@ askinfo() { \
[ -z "$realname" ] && echo "Give the name you would like to be identified by on the email account:" && [ -z "$realname" ] && echo "Give the name you would like to be identified by on the email account:" &&
read -r realname read -r realname
login="${login:-$fulladdr}" 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" 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 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 ;; l) setact list || exit 1 ;;
d) setact delete || exit 1 ;; d) setact delete || exit 1 ;;
D) setact delete || exit 1 ; fulladdr="$OPTARG" ;; 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" ;; m) setact add || exit 1 ; maxmes="$OPTARG" ;;
o) setact add || exit 1 ; online=True ;; o) setact add || exit 1 ; online=True ;;
f) setact add || exit 1 ; force=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." p) echo "NOTE: Protonmail users must install and configure Protonmail Bridge first for the first sync to work."
proton=True proton=True
imap="127.0.0.1" imap="127.0.0.1"


+ 3
- 0
mw.1 View File

@@ -58,6 +58,9 @@ SMTP server address
.TP .TP
.B -S .B -S
SMTP server port (assumed to be 587 if not specified) 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 .SH OTHER OPTIONS
.TP .TP
.B -f .B -f


Loading…
Cancel
Save