subscribe command in muttrc

This commit is contained in:
Bob Mottram 2015-04-08 23:30:11 +01:00
parent 8d0d722095
commit 3a3b1784a8
4 changed files with 25 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@ -32,10 +32,11 @@
MYUSERNAME=$USER
MAILINGLIST=
SUBJECTTAG=
LIST_ADDRESS=
function show_help {
echo ''
echo 'freedombone-addlist -u [username] -l [mailing list name] -s [subject tag]'
echo 'freedombone-addlist -u [username] -l [mailing list name] -s [subject tag] -e [list email address]'
echo ''
exit 0
}
@ -60,6 +61,10 @@ case $key in
shift
SUBJECTTAG="$1"
;;
-e|--email)
shift
LIST_ADDRESS="$1"
;;
*)
# unknown option
;;
@ -113,4 +118,11 @@ if [[ $MUTT_MAILBOXES != *$MAILINGLIST* ]]; then
chown $MYUSERNAME:$MYUSERNAME $MUTTRC
fi
if [ $LIST_ADDRESS ]; then
sed -i "s|unsubscribe $LIST_ADDRESS|subscribe $LIST_ADDRESS|g" $MUTTRC
if ! grep -q "subscribe $LIST_ADDRESS" $MUTTRC; then
echo "subscribe $LIST_ADDRESS" >> $MUTTRC
fi
fi
exit 0

View File

@ -31,10 +31,11 @@
MYUSERNAME=$USER
MAILINGLIST=
LIST_ADDRESS=
function show_help {
echo ''
echo 'freedombone-rmlist -u [username] -l [mailing list name]'
echo 'freedombone-rmlist -u [username] -l [mailing list name] -e [list email address]'
echo ''
exit 0
}
@ -55,6 +56,10 @@ case $key in
shift
MAILINGLIST="$1"
;;
-e|--email)
shift
LIST_ADDRESS="$1"
;;
*)
# unknown option
;;
@ -73,4 +78,10 @@ if [[ $MUTT_MAILBOXES == *$MAILINGLIST* ]]; then
chown $MYUSERNAME:$MYUSERNAME $MUTTRC
fi
if [ $LIST_ADDRESS ]; then
if ! grep -q "unsubscribe $LIST_ADDRESS" $MUTTRC; then
sed -i "s|subscribe $LIST_ADDRESS|unsubscribe $LIST_ADDRESS|g" $MUTTRC
fi
fi
exit 0