From 8a7ef34b079786ddeba73e8beba11af660d9433e Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Wed, 15 Jun 2011 08:24:14 -0400 Subject: Plumb key=value arguments through to the `bin/mailman inject` command. --- src/mailman/commands/cli_inject.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/mailman/commands/cli_inject.py') 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) -- cgit v1.2.3-70-g09d2