summaryrefslogtreecommitdiff
path: root/src/mailman/commands/docs/lists.rst
blob: 04e0d744d581e668b826f4fa9a4311e83544f918 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
=========================
Command line list display
=========================

A system administrator can display all the mailing lists via the command
line.  When there are no mailing lists, a helpful message is displayed.
::

    >>> class FakeArgs:
    ...     advertised = False
    ...     names = False
    ...     descriptions = False
    ...     quiet = False
    ...     domains = None

    >>> from mailman.commands.cli_lists import Lists
    >>> command = Lists()
    >>> command.process(FakeArgs)
    No matching mailing lists found

When there are a few mailing lists, they are shown in alphabetical order by
their fully qualified list names, with a description.
::

    >>> from mailman.interfaces.domain import IDomainManager
    >>> from zope.component import getUtility
    >>> getUtility(IDomainManager).add('example.net')
    <Domain example.net...>

    >>> mlist_1 = create_list('list-one@example.com')
    >>> mlist_1.description = 'List One'

    >>> mlist_2 = create_list('list-two@example.com')
    >>> mlist_2.description = 'List Two'

    >>> mlist_3 = create_list('list-one@example.net')
    >>> mlist_3.description = 'List One in Example.Net'

    >>> command.process(FakeArgs)
    3 matching mailing lists found:
    list-one@example.com
    list-one@example.net
    list-two@example.com


Names
=====

You can display the mailing list names with their posting addresses, using the
``--names/-n`` switch.

    >>> FakeArgs.names = True
    >>> command.process(FakeArgs)
    3 matching mailing lists found:
    list-one@example.com [List-one]
    list-one@example.net [List-one]
    list-two@example.com [List-two]


Descriptions
============

You can also display the mailing list descriptions, using the
``--descriptions/-d`` option.

    >>> FakeArgs.descriptions = True
    >>> command.process(FakeArgs)
    3 matching mailing lists found:
    list-one@example.com [List-one] - List One
    list-one@example.net [List-one] - List One in Example.Net
    list-two@example.com [List-two] - List Two

Maybe you want the descriptions but not the names.

    >>> FakeArgs.names = False
    >>> command.process(FakeArgs)
    3 matching mailing lists found:
    list-one@example.com - List One
    list-one@example.net - List One in Example.Net
    list-two@example.com - List Two


Less verbosity
==============

There's also a ``--quiet/-q`` switch which reduces the verbosity a bit.

    >>> FakeArgs.quiet = True
    >>> FakeArgs.descriptions = False
    >>> command.process(FakeArgs)
    list-one@example.com
    list-one@example.net
    list-two@example.com


Specific domain
===============

You can narrow the search down to a specific domain with the --domain option.
A helpful message is displayed if no matching domains are given.

    >>> FakeArgs.quiet = False
    >>> FakeArgs.domain = ['example.org']
    >>> command.process(FakeArgs)
    No matching mailing lists found

But if a matching domain is given, only mailing lists in that domain are
shown.

    >>> FakeArgs.domain = ['example.net']
    >>> command.process(FakeArgs)
    1 matching mailing lists found:
    list-one@example.net

More than one --domain argument can be given; then all mailing lists in
matching domains are shown.

    >>> FakeArgs.domain = ['example.com', 'example.net']
    >>> command.process(FakeArgs)
    3 matching mailing lists found:
    list-one@example.com
    list-one@example.net
    list-two@example.com


Advertised lists
================

Mailing lists can be 'advertised' meaning their existence is public
knowledge.  Non-advertised lists are considered private.  Display through the
command line can select on this attribute.
::

    >>> FakeArgs.domain = []
    >>> FakeArgs.advertised = True
    >>> mlist_1.advertised = False

    >>> command.process(FakeArgs)
    2 matching mailing lists found:
    list-one@example.net
    list-two@example.com