Abhilash Raj pushed to branch master at GNU Mailman / Mailman Core


Commits:
e1500740 by Daniel Teichmann at 2019-08-25T18:42:01Z
Add docs for ``mailman members --delete`` command.

- - - - -
e8c62280 by Abhilash Raj at 2019-08-25T18:42:01Z
Merge branch 'mr/remove_members_cmd_docs' into 'master'

Add docs for ``mailman members --delete`` command

See merge request mailman/mailman!547
- - - - -


1 changed file:

- src/mailman/commands/docs/members.rst


Changes:

=====================================
src/mailman/commands/docs/members.rst
=====================================
@@ -3,7 +3,7 @@ Managing members
 ================
 
 The ``mailman members`` command allows a site administrator to display, add,
-and remove members from a mailing list.
+and delete members from a mailing list.
 
     >>> command = cli('mailman.commands.cli_members.members')
 
@@ -252,18 +252,96 @@ printed.
     [email protected]
 
 
-Displaying members
-==================
+Deleting members
+==============
 
-With no arguments, the command displays all members of the list.
+You can delete members from a mailing list from the command line.  To do so, 
you
+need a file containing email addresses and full names that can be parsed by
+``email.utils.parseaddr()``.  All mail addresses in the file will be deleted
+from the mailing list.
 
-    >>> command('mailman members bee.example.com')
-    [email protected]
+Assuming you have populated a mailing list with the code examples from above,
+use these code snippets to delete subscriptions from the list again.
+::
+
+    >>> with open(filename, 'w', encoding='utf-8') as fp:
+    ...     print("""\
+    ... [email protected]
+    ... [email protected] (Cate Person)
+    ... """, file=fp)
+
+    >>> command('mailman members --delete ' + filename + ' bee.example.com')
+
+    >>> from operator import attrgetter
+    >>> dump_list(bee.members.addresses, key=attrgetter('email'))
     Bart Person <[email protected]>
-    Cate Person <[email protected]>
     [email protected]
     Elly Person <[email protected]>
     Fred Person <[email protected]>
     [email protected]
     [email protected]
     [email protected]
+
+You can also specify ``-`` as the filename, in which case the addresses are
+taken from standard input.
+::
+
+    >>> stdin = """\
+    ... [email protected]
+    ... Elly Person <[email protected]>
+    ... """
+    >>> command('mailman members --delete - bee.example.com', input=stdin)
+
+    >>> dump_list(bee.members.addresses, key=attrgetter('email'))
+    Bart Person <[email protected]>
+    Fred Person <[email protected]>
+    [email protected]
+    [email protected]
+    [email protected]
+
+Blank lines and lines that begin with '#' are ignored.
+::
+
+    >>> with open(filename, 'w', encoding='utf-8') as fp:
+    ...     print("""\
+    ... # [email protected]
+    ...
+    ... [email protected]
+    ... """, file=fp)
+
+    >>> command('mailman members --delete ' + filename + ' bee.example.com')
+
+    >>> dump_list(bee.members.addresses, key=attrgetter('email'))
+    Fred Person <[email protected]>
+    [email protected]
+    [email protected]
+    [email protected]
+
+Addresses which are not subscribed are ignored, although a warning is
+printed.
+::
+
+    >>> with open(filename, 'w', encoding='utf-8') as fp:
+    ...     print("""\
+    ... [email protected]
+    ... [email protected]
+    ... """, file=fp)
+
+    >>> command('mailman members --delete ' + filename + ' bee.example.com')
+    Member not subscribed (skipping): [email protected]
+
+    >>> dump_list(bee.members.addresses, key=attrgetter('email'))
+    Fred Person <[email protected]>
+    [email protected]
+    [email protected]
+
+
+Displaying members
+==================
+
+With no arguments, the command displays all members of the list.
+
+    >>> command('mailman members bee.example.com')
+    Fred Person <[email protected]>
+    [email protected]
+    [email protected]



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/e8ef9a8a63af7cb30dce15bdcaf5be14d1ad3d43...e8c622809eb08c55c59ba8118043bfe5add8a14b

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/e8ef9a8a63af7cb30dce15bdcaf5be14d1ad3d43...e8c622809eb08c55c59ba8118043bfe5add8a14b
You're receiving this email because of your account on gitlab.com.


_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to