summaryrefslogtreecommitdiff
path: root/src/mailman/commands/cli_inject.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/commands/cli_inject.py')
-rw-r--r--src/mailman/commands/cli_inject.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/mailman/commands/cli_inject.py b/src/mailman/commands/cli_inject.py
index 1d019d9e0..a3e61e2a4 100644
--- a/src/mailman/commands/cli_inject.py
+++ b/src/mailman/commands/cli_inject.py
@@ -50,7 +50,7 @@ class Inject:
self.parser = parser
command_parser.add_argument(
'-q', '--queue',
- type=unicode, help=_("""\
+ type=unicode, help=_("""
The name of the queue to inject the message to. QUEUE must be one
of the directories inside the qfiles directory. If omitted, the
incoming queue is used."""))
@@ -66,9 +66,16 @@ class Inject:
# Required positional argument.
command_parser.add_argument(
'listname', metavar='LISTNAME', nargs=1,
- help=_("""\
+ help=_("""
The 'fully qualified list name', i.e. the posting address of the
mailing list to inject the message into."""))
+ command_parser.add_argument(
+ '-m', '--metadata',
+ dest='keywords', action='append', default=[], metavar='KEY=VALUE',
+ help=_("""
+ Additional metadata key/value pairs to add to the message metadata
+ dictionary. Use the format key=value. Multiple -m options are
+ allowed."""))
def process(self, args):
"""See `ICLISubCommand`."""
@@ -104,4 +111,8 @@ class Inject:
else:
with open(args.filename) as fp:
message_text = fp.read()
- inject_text(mlist, message_text, switchboard=queue)
+ keywords = {}
+ for keyvalue in args.keywords:
+ key, equals, value = keyvalue.partition('=')
+ keywords[key] = value
+ inject_text(mlist, message_text, switchboard=queue, **keywords)