diff options
Diffstat (limited to 'bin/mw')
| -rwxr-xr-x | bin/mw | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -131,6 +131,30 @@ EOF iport="${iport:-$iportsugg}" } +userinfo() { + if [ -z "${fulladdr+x}" ]; then + echo "Select the account you would like to delete (by number):" + list || exit 1 + read -r input + match="^\s*$input\s\+" + else + match="\s\+$fulladdr$" + getaccounts + fi + + fulladdr="$(echo "$accounts" | grep "$match" | grep -o "\S*@\S*")" + + [ -z "$fulladdr" ] && echo "$fulladdr is not a valid account name." && return 1 + + awk -v user="$fulladdr" ' + BEGIN {found = 0; in_block = 0; block = ""} + /^account / {if (found) {exit} in_block = 1; block = ""} # Start a new block, stop if user found + in_block {block = block $0 "\n"} # Append lines to the block + in_block && /^user / && $2 == user {found = 1} # Mark when the user is found + END {if (found) printf "%s", block} # Print the stored block if found + ' "$msmtprc" +} + delete() { if [ -z "${fulladdr+x}" ]; then echo "Select the account you would like to delete (by number):" @@ -340,7 +364,7 @@ reorder() { ' "$tempfile" >>"$muttrc" } -while getopts "cdfhloprTXYa:D:i:I:m:n:N:P:s:S:t:x:y:" o; do case "${o}" in +while getopts "cdfhloprTuXYa:D:i:I:m:n:N:P:s:S:t:x:y:" o; do case "${o}" in c) setact create ;; d) setact delete ;; f) @@ -410,6 +434,7 @@ while getopts "cdfhloprTXYa:D:i:I:m:n:N:P:s:S:t:x:y:" o; do case "${o}" in setact toggle cronmin="$OPTARG" ;; + u) setact info ;; x) setact add password="$OPTARG" @@ -430,6 +455,7 @@ case "$action" in add) checkbasics && askinfo && getboxes && getprofiles && finalize ;; create) basicdir ;; delete) delete ;; +info) userinfo ;; list) list ;; reorder) reorder ;; sync) |
