mcomp: add mime menu option

This commit is contained in:
Christian Neukirchen 2016-07-20 23:17:38 +02:00
parent be7d711cdf
commit a2f2a80ee2

31
mcomp
View File

@ -66,13 +66,38 @@ c=e
while :; do while :; do
case "$c" in case "$c" in
s|send) s|send)
sendmail -t <$draft && rm $draft if [ -e $draft.mime ]; then
exit $? if [ $draft -ot $draft.mime ]; then
if sendmail -t <$draft.mime; then
rm $draft $draft.mime
exit 0
else
echo "mcomp: sendmail failed, kept draft $draft"
exit 2
fi
else
echo "mcomp: re-run mmime first."
c=
fi
else
if sendmail -t <$draft; then
rm $draft
exit 0
else
echo "mcomp: sendmail failed, kept draft $draft"
exit 2
fi
fi
;; ;;
c|cancel) c|cancel)
echo "mcomp: cancelled draft $draft" echo "mcomp: cancelled draft $draft"
exit 1 exit 1
;; ;;
m|mime)
mmime <$draft >$draft.mime
mshow -t ./$draft.mime
c=
;;
e|edit) e|edit)
c= c=
if ! ${EDITOR:-vi} $draft; then if ! ${EDITOR:-vi} $draft; then
@ -80,7 +105,7 @@ while :; do
fi fi
;; ;;
*) *)
echo -n "What now? ([s]end, [c]ancel, [e]dit) " echo -n "What now? ([s]end, [c]ancel, [e]dit, [m]ime) "
read -r c read -r c
;; ;;
esac esac